CHORE: Upgrade ruff to ~0.12.8 #2734
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subjectively, there have been more issues recently with contributor PRs being rejected by ruff. This could possibly be caused by them using a different ruff version (presumably: more recent). This PR upgrades ruff to the latest version to hopefully reduce these issues.
The only change needed to make this ruff version pass was to disable UP045. This rule requires changing code like:
x: Optional[int]into
x: int | Nonein 220 places. Personally, I don't think it's crucial. Moreover, ruff won't fix this automatically, except with
--unsafe-fixes. Note that Python 3.9 needs a__future__import for this, so that could be the reason why it's not done automatically. Perhaps, once Python 3.9 is dropped, we can revisit this. For now, my preference is thus just to disable the rule, but LMK if you disagree.