Upgrading ruff 0.9 to 0.10
Breaking0.9.10 → 0.10.0Breaking5Deprecated3New7Changed23Fixed5
BreakingUpgrade verdict
5 breaking changes.
In plain terms
- Ruff now treats any local variable called TYPE_CHECKING as a type-checking block, and no longer supports the old if 0: or if False: style.
- The ruff:alpine Docker image now uses Alpine 3.21 instead of 3.20, and the ruff:alpine3.20 image will no longer receive updates.
- Ruff now determines which Python version to assume differently when you have not set target-version. This change was meant for 0.10.0 but shipped in 0.11.0 instead.
- Ruff reads its suppression comments (noqa) more consistently now. Most comments will still work, but a few that used to be read will now log an error.
Must act Top 5 of 8 that need code or config changes
What you must change
Breaking5
Recognizes any local variable named TYPE_CHECKING and removes support for legacy if 0: and if False: typechecking checks.
TYPE_CHECKINGtyping.TYPE_CHECKINGBumps the alpine default tag to 3.21 for derived Docker images; ruff:alpine3.20 is no longer updated.
ruff:alpineruff:alpine3.20Changes how the Python version is inferred when target-version is not specified, though this was actually released in 0.11.0.
target-versionUnifies file-level and in-line suppression comment syntax and makes noqa parsing more robust to errors.
noqaFixes formatter bug that added unnecessary parentheses around with statements with a single context manager and a trailing comment.
Deprecations to plan for
Deprecated3
Deprecates the non-pep604-isinstance rule (UP038).
UP038non-pep604-isinstanceDeprecates the suspicious-xmle-tree-usage rule (S320).
S320suspicious-xmle-tree-usageDeprecates the
builtins- prefixed options in favor of unprefixed options, e.g. builtins-allowed-modules becomes allowed-modules.builtins-allowed-modulesallowed-modules