-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Don't tie pyupgrade changes to dropping of support for a Python version #13236
Comments
My only strong opinion is that some pyupgrade rules should be enabled as part of regular CI, it prevents contributors from using depricated aliases or styles, e.g. UP005, UP020, UP032, etc.
One thing that could be done to do this without turning off pyupgrade rules is to set the minimum Python version in ruff configuration directly: https://docs.astral.sh/ruff/settings/#target-version. Then the pyupgrade rules won't kick in when |
This was done in #13238, I don't know if it's worth documenting somewhere for future PRs that drop Python support? |
Probably. I'm not sure where would be a good place, though - we don't really have any documentation around our linter setup or style guidelines, as far as I know 🙁 |
I think the comment we have in pyproject.toml is sufficient documentation for future PRs that drop Python support.
|
See #13185 (comment) and following comments for background.
Currently, we include ruff's "pyupgrade" rules in our default configuration. This means that any code which doesn't follow those rules will fail our lint checks. The auto-fixer will deal with such issues, and for day to day use this is perfectly fine. However, when we drop support for a particular Python version, this has a number of undesirable consequences:
I would prefer it if our policy was to create a separate PR to apply changes recommended by pyupgrade, at some point after a Python version has been desupported. I'm not concerned if it's immediately after, or after some time has passed - that's a judgement that can be made based on the size and impact of the change. What matters is that the automated changes from pyupgrade are in a separate PR, independent of the "drop support" PR.
If that means we have to disable the pyupgrade checks in our ruff configuration, then I'm OK with that. But equally, if it's possible somehow to have ruff warn about then without making them must-fix problems, I'd be fine with that as well. I'm not sufficiently familiar with our linting setup to know if that's an option.
Footnotes
I'm assuming by accident, but there's also the potential for malicious changes - the xz utils backdoor isn't something we can ignore. ↩
The text was updated successfully, but these errors were encountered: