Description
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:
- Dropping support includes a potentially large change consisting of the pyupgrade fixes. Review of this commit should be straightforward, as it's all automatically generated, but it's probably mixed in with other commits doing other parts of the "drop support" exercise. Also, there's nothing that requires the pyupgrade changes to be isolated in a single commit, so it's possible for unrelated changes to slip in1, and get missed in the review.
- By tying the switch to using newer features to the dropping of support, we increase the impact of dropping support. Why deliberately break users when we don't immediately need to? Furthermore, if the pyupgrade changes are part of the "drop support" PR, reverting just the pyupgrade changes becomes more complex (either revert the whole PR dropping support, or cherry pick the specific commit, if there is one).
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. ↩
Activity