-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[pre-commit] Add pyupgrade back as a manual stage #12418
Conversation
Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
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 wondering it we should keep pyupgrade in the pre-commit hooks then. ruff was at feature parity at some point but not anymore it seems. Or we could wait for ruff to keep up with feature parity and close this MR until then.
This might just be a bug in ruff, with some special case (maybe the |
BTW soon in Oct this year python 3.8 will be EOSed. |
ruff has integrated pyupgrade functionality for a long time already (possibly since the beginning?). |
Just try to take few modules and filter over |
You'll need to enable the respective rules (like pytest does). |
And I've tested that with those rules several times. |
We activated all of ruff's pyupgrade messages: Line 110 in 0070151
So yes, not feature parity, but the diff of this MR is the only remaining change pyupgrade have to apply in 4 months. (#11911 merge on 2024-02-02). Maybe there were a lot of diff we could have had faster and ruff caught up fast enough to not have a big diff now but I'm not sure it's worth the extra wait for each commit, for each developers, for 4 months. Applying pyupgrade manually when each python interpreter dropped is also a possibility. That way we don't have to wait longer for each git commit and we can still benefit from pyupgrade's features not included in ruff, eventually. |
I'm OK with this, that's what I do in my other projects: I apply |
We could also just report findings upstream so that by the time we drop,ruff has parity |
Launchable with ``pre-commit run --hook-stage manual pyupgrade -a``
I pushed what I think is a good compromise: added pyupgrade back as a manual stage, this make it easily launchable with |
rev: v3.15.2 | ||
hooks: | ||
- id: pyupgrade | ||
stages: [manual] |
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.
TIL
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.
Previously added pylint this way so can be launched similarly with pre-commit run --hook-stage manual pylint -a
:)
pyupgrade --py38-plus
Thank you 👍 |
No description provided.