Skip to content

Commit

Permalink
Put Flake8 requirements into their own file (pytorch#49032)
Browse files Browse the repository at this point in the history
Summary:
This PR moves the list of Flake8 requirements/versions out of `.github/workflows/lint.yml` and into its own file `requirements-flake8.txt`. After (if) this PR is merged, I'll modify the Flake8 installation instructions on [the "Lint as you type" wiki page](https://github.com/pytorch/pytorch/wiki/Lint-as-you-type) (and its internal counterpart) to just say to install from that new file, rather than linking to the GitHub Actions YAML file and/or giving a command with a set of packages to install that keeps becoming out-of-date.

Pull Request resolved: pytorch#49032

Test Plan:
Either look at CI, or run locally using [act](https://github.com/nektos/act):
```sh
act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -j flake8-py3
```

Reviewed By: janeyx99

Differential Revision: D25404037

Pulled By: samestep

fbshipit-source-id: ba4d1e17172a7808435df06cba8298b2b91bb27c
  • Loading branch information
samestep authored and facebook-github-bot committed Dec 8, 2020
1 parent 2b70bcd commit d1fb4b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Run flake8
run: |
set -eux
pip install flake8==3.8.2 flake8-bugbear==20.1.4 flake8-comprehensions==3.3.0 flake8-executable==2.0.4 flake8-pyi==20.5.0 mccabe pycodestyle==2.6.0 pyflakes==2.2.0
pip install -r requirements-flake8.txt
flake8 --version
flake8 | tee ${GITHUB_WORKSPACE}/flake8-output.txt
- name: Add annotations
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ which is in PyTorch's `requirements.txt`.
## Pre-commit tidy/linting hook

We use clang-tidy and flake8 (installed with flake8-bugbear,
flake8-comprehensions, flake8-mypy, and flake8-pyi) to perform additional
flake8-comprehensions, flake8-pyi, and others) to perform additional
formatting and semantic checking of code. We provide a pre-commit git hook for
performing these checks, before a commit is created:

Expand Down
8 changes: 8 additions & 0 deletions requirements-flake8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
flake8==3.8.2
flake8-bugbear==20.1.4
flake8-comprehensions==3.3.0
flake8-executable==2.0.4
flake8-pyi==20.5.0
mccabe
pycodestyle==2.6.0
pyflakes==2.2.0

0 comments on commit d1fb4b4

Please sign in to comment.