Ruff v0.7.0 is available now! Install it from PyPI, or your package manager of choice:

uv pip install --upgrade ruff

As a reminder: Ruff is an extremely fast Python linter and formatter, written in Rust. Ruff can be used to replace Black, Flake8 (plus dozens of plugins), isort, pydocstyle, pyupgrade, and more, all while executing tens or hundreds of times faster than any individual tool.


Migrating to v0.7

As with most Ruff minor releases, this release contains few breaking changes: most of our users should be able to upgrade to the latest Ruff version without having to make any significant edits to their code or configuration.

With that said, here are a few things to keep in mind when upgrading:

  • Some users will experience new default settings for the rules PT001 and PT023 (in our flake8-pytest category). This was a change we tried to make in Ruff v0.6 but, due to an error on our part, not all users saw the change in behavior. See below for more details.
  • The useless-try-except rule (in our tryceratops category) has been recoded from TRY302 to TRY203. This ensures Ruff's code is consistent with the same rule in the tryceratops linter.
  • The lint.allow-unused-imports setting has been removed. Use lint.pyflakes.allow-unused-imports instead.
  • open-file-with-context-handler (SIM115), a rule which looks for files opened without the use of context managers, now has more expansive behavior. Whereas before it would only look for files opened using the builtin open() function or pathlib.Path(...).open(), it can now detect files being opened using a wide range of other standard-library functions and classes. This improved capability has been available to users of preview mode for several months, but has now been promoted to stable.

Default behavior changed for flake8-pytest-style rules

(This time with feeling.)

In Ruff v0.6, we tried to change the default behavior for pytest-fixture-incorrect-parentheses-style and pytest-incorrect-mark-parentheses-style (PT001 and PT023 respectively). The default behavior did indeed change in Ruff v0.6 for many of our users.

Unfortunately, however, some users were still experiencing the old defaults. The specific details of whether users would receive the updated behavior depended on exactly which configuration options were specified (or unspecified) in their Ruff configuration file (pyproject.toml, ruff.toml, or similar).

This bug has now been fixed, thanks to a contribution from Alexey Preobrazhenskiy: in Ruff v0.7, all users will experience the new default behavior.

To recap on the changes that were only partially made in Ruff v0.6: previously, PT001 would by default change @pytest.fixture decorators to @pytest.fixture(), and PT023 would change @pytest.mark.foo decorators to @pytest.mark.foo().

They will now both remove parentheses by default, rather than adding them. This means that these rules now adhere more closely to the style recommendations made by the official pytest project.

These rules are both configurable. To revert to Ruff's previous default behaviors, use the lint.flake8-pytest-style.mark-parentheses and lint.flake8-pytest-style.fixture-parentheses settings in your Ruff configuration file. For example, in a pyproject.toml file:

[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = true
mark-parentheses = true

These rules also both come with safe fixes, so you should be able to easily fix any new violations of these rules caused by this change by running ruff check . --fix --select=PT001 --select=PT023.


View the full changelog on GitHub.

Read more about Astral — the company behind Ruff.