Change8

0.10.0

Breaking Changes
📦 ruffView on GitHub →
5 breaking🐛 2 fixes3 deprecations🔧 6 symbols

Summary

Ruff 0.10.0 adds several breaking changes—including updated TYPE_CHECKING handling, stricter noqa parsing, and a Docker base image bump—while deprecating two rules and some configuration options.

⚠️ Breaking Changes

  • Python version inference changed when `target-version` is not specified; upgrade may require explicitly setting `target-version` or adjusting configuration (see #16319).
  • TYPE_CHECKING handling updated: Ruff now recognizes any local variable named `TYPE_CHECKING` and drops support for legacy `if 0:` and `if False:` checks; replace those with a local `TYPE_CHECKING` variable.
  • Noqa comment parsing made more robust and unified; some previously accepted suppression comments will now raise errors—review and adjust `noqa` comments accordingly.
  • Formatter now avoids adding unnecessary parentheses around `with` statements that have a single context manager and a trailing comment, which may change formatting output.
  • Docker Alpine base image tag bumped to 3.21; the `ruff:alpine` image now uses Alpine 3.21 and `ruff:alpine3.20` will no longer receive updates.

Migration Steps

  1. Read the migration guide in the blog post: https://astral.sh/blog/ruff-v0.10.0.
  2. If you relied on implicit Python version inference, explicitly set `target-version` in your configuration.
  3. Replace legacy `if 0:` or `if False:` type‑checking blocks with a local variable named `TYPE_CHECKING`.
  4. Review all `# noqa` comments; adjust any that now trigger errors due to the new parsing rules.
  5. Update Docker images to use `ruff:alpine` (Alpine 3.21) or pin to a specific tag if you need the older base.
  6. Rename deprecated `builtins-` configuration options to their unprefixed equivalents.

🐛 Bug Fixes

  • Removed logging output for `ruff.printDebugInformation`.
  • [flake8-bandit] Fixed mixed ...

🔧 Affected Symbols

ruff.printDebugInformationTYPE_CHECKING handling (linting logic)RUF035 (now S704)non-pep604-isinstance (UP038)suspicious-xmle-tree-usage (S320)flake8-builtins configuration options

⚡ Deprecations

  • `non-pep604-isinstance` rule (`UP038`) is deprecated.
  • `suspicious-xmle-tree-usage` rule (`S320`) is deprecated.
  • `flake8-builtins` configuration options prefixed with `builtins-` are deprecated in favor of unprefixed options (e.g., `allowed-modules`).