Change8

Migrating to Ruff 0.10.0

Version 0.10.0 introduces 5 breaking changes. This guide details how to update your code.

Released: 3/13/2025

5
Breaking Changes
6
Migration Steps
6
Affected Symbols

⚠️ Check Your Code

If you use any of these symbols, you need to read this guide:

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

Breaking Changes

Issue #1

Python version inference changed when `target-version` is not specified; upgrade may require explicitly setting `target-version` or adjusting configuration (see #16319).

Issue #2

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.

Issue #3

Noqa comment parsing made more robust and unified; some previously accepted suppression comments will now raise errors—review and adjust `noqa` comments accordingly.

Issue #4

Formatter now avoids adding unnecessary parentheses around `with` statements that have a single context manager and a trailing comment, which may change formatting output.

Issue #5

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

Release 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.

Need More Details?

View the full release notes and all changes for Ruff 0.10.0.

View Full Changelog