Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

[MLH] Pre-commit Hooks Configuration Changes #283

Closed
wants to merge 5 commits into from

Conversation

grace-omotoso
Copy link

  • Update pre-commit steps and isort configuration
  • Update CI test command

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 8, 2021
@prigoyal prigoyal self-requested a review April 9, 2021 12:28
@facebook-github-bot
Copy link
Contributor

@prigoyal has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@prigoyal prigoyal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you so much. Can we take a look at one comment inline? :)

@@ -6,23 +6,19 @@
from argparse import Namespace
from typing import Any, List

from hydra.experimental import compose, initialize_config_module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akainth015 , @grace-omotoso , do we know what triggered this change? it doesn't seem aligned with the linter to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems correct to me, moved from line 13 to up here, probably because hydra is considered 3rd party

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, thank you for clarifying. This currently conflicts with the linter we have at facebook which expects the alphabetical ordering. Is it possible to address this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, does that mean alphabetical within the same block of imports? We could remove the no_lines_before = FIRSTPARTY directive, perhaps that would solve the issue? Although it would result in a lot of changes to existing files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @akainth015 I am new to the vissl team at FB. This PR looks great -- it will be a huge help to us!!

I think this may have been caused by removing the known_third_party above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @iseessel, nice to meet you! Glad that this will be useful

We could add extra_scripts to the known_third_party option; that would address the issue. Semantically, is that acceptable?

@@ -9,5 +9,6 @@ line_length = 88
multi_line_output = 3
use_parentheses = True
lines_after_imports = 2
known_third_party = PIL,bs4,classy_vision,cv2,detectron2,fairscale,faiss,fvcore,hydra,mock,nbconvert,nbformat,numpy,omegaconf,parameterized,pkg_resources,pycocotools,recommonmark,run_distributed_engines,scipy,setuptools,sklearn,sphinx_rtd_theme,tabulate,torch,torchvision,tqdm,utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to revert this?

Copy link
Contributor

@akainth015 akainth015 Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but since that was generated by seed-isort-config it seemed better to remove it, as directed by the isort documentation.

@@ -9,5 +9,6 @@ line_length = 88
multi_line_output = 3
use_parentheses = True
lines_after_imports = 2
known_third_party = PIL,bs4,classy_vision,cv2,detectron2,fairscale,faiss,fvcore,hydra,mock,nbconvert,nbformat,numpy,omegaconf,parameterized,pkg_resources,pycocotools,recommonmark,run_distributed_engines,scipy,setuptools,sklearn,sphinx_rtd_theme,tabulate,torch,torchvision,tqdm,utils
ensure_newline_before_comments = True
no_lines_before = FIRSTPARTY
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend to not introduce the new rule in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these rules to minimize the effect the upgrade had on the existing files.

@prigoyal
Copy link
Contributor

thank you! I'll patch this PR today and test it and will aim to land it/merge it.

@grace-omotoso grace-omotoso changed the title Mlh pr [MLH] Pre-commit Hooks Configuration Changes Apr 12, 2021
@facebook-github-bot
Copy link
Contributor

@grace-omotoso has updated the pull request. You must reimport the pull request before landing.

@iseessel iseessel self-requested a review April 14, 2021 13:49
@facebook-github-bot
Copy link
Contributor

@grace-omotoso has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@prigoyal has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@prigoyal merged this pull request in 3c41d0a.

@akainth015 akainth015 deleted the mlh_pr branch April 15, 2021 17:28
@akainth015 akainth015 restored the mlh_pr branch April 15, 2021 17:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants