-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lint (black/pyflakes) everything that looks like python code using pre-commit #1461
Conversation
`pipx run modernize -wn docs/historic/2003/pycon/`
e9ea0cc
to
87c7360
Compare
|
I was somewhat conflicted on fixing the historic/2003 python docs - but the changes made to make them syntactically valid under python3 are so minimal that I think it's worth doing. I'd rather delete them than shade them from the light of black |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow! Great stuff :)
Happy to see this and I think that this PR is on the right path
A have a few major comments before approving this.
See inline comments.
Thanks!
| @@ -10,7 +10,7 @@ jobs: | |||
| lint: | |||
| runs-on: ubuntu-20.04 | |||
| env: | |||
| TOXENV: "lint,black,twine" | |||
| TOXENV: "lint,twine" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need twine here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. twine runs other checks on the built wheel and doesn't really fit with the pre-commit model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I guess this will be removed in the followup PR with the new wheel+sdist build workflow... or am O lost ? ... again :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keeping twine still in the release PR too
| Or, for speed, specify exactly what to format:: | ||
|
|
||
| $ tox -e black-reformat -- path/to/file.py | ||
| $ pipx run pre-commit run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a tox pre-commit env as the "standard" tool... pipx is great, but I think that is best to keep all in tox.
People who will want to run pipx or just custom virtualenv could then use the rules from tox to see how to run-precommit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tox -e lint -- run does that already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Them maybe suggest
| $ pipx run pre-commit run | |
| $ tox -e lint -- run |
I would prefer tox -e lint to only run on changes since trunk. and have tox -e lint --all-files to be used by CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running via tox instead of pipx adds quite a bit of slowness - pipx here is more of a demo on how it could be installed.
| - repo: https://gitlab.com/pycqa/flake8 | ||
| rev: 3.8.3 | ||
| hooks: | ||
| - id: flake8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake8 runs only pyflakes by default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, flake8 runs pycodestyle and pyflakes, Ive ignored all the pycodestyle violations that currently stand, and double checked the pyflakes violations are not ignored
I think we can keep them...since they are historic. ... but is ok to update then with black. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Only minor comments.
This is ready for merge.
| Or, for speed, specify exactly what to format:: | ||
|
|
||
| $ tox -e black-reformat -- path/to/file.py | ||
| $ pipx run pre-commit run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Them maybe suggest
| $ pipx run pre-commit run | |
| $ tox -e lint -- run |
I would prefer tox -e lint to only run on changes since trunk. and have tox -e lint --all-files to be used by CI.
Co-authored-by: Adi Roiban <adiroiban@gmail.com>
|
@graingert You removed the Do you plan to update the wiki? @adiroiban / @wsanchez When reviewing this type of stuff, please double check that any documentation changes on the wiki are updated as well. |
|
Thanks for the followup. Well, we do our best with the review I think that anyone can update the Wiki without the need for a review... so feel free to update the wiki page. I would like to stop using the wiki and instead use the repo's docs for documentation. In this way, everything can be done in a single PR. We now have up to date docs based on the trunk branch at https://docs.twistedmatrix.com/en/latest/core/development/index.html |
I tend to agree, in this case I think we should delete the outdated wiki version of these docs and link to the updated version on https://docs.twistedmatrix.com/ |
|
@graingert for now, can you update the wiki as I have asked? While not perfect, the wiki has been around for a long time, The Twisted Development process is a very important part of the Twisted project. If this is deleted from the wiki |
Contributor Checklist:
tox -e black-reformatto format my patch to meet the Twisted Coding Standardreviewto the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.