惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
博客园_首页
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
美团技术团队
小众软件
小众软件
Jina AI
Jina AI
S
SegmentFault 最新的问题
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

Blog - Astral

Our endorsements for Python’s first Packaging Council Ruff v0.16.0 Vulnerability and malware checks in uv Open source security at Astral Astral to join OpenAI Ruff v0.15.0 ty: An extremely fast Python type checker and language server Python 3.14 Ruff v0.13.0 Astral OSS Fund: One Year Later pyx: a Python-native package registry, now in Beta An experimental, variant-enabled build of uv uv security advisory: ZIP payload obfuscation Ruff v0.12.0 Ruff v0.10.0 Ruff v0.9.0 A new home for python-build-standalone Ruff v0.8.0 uv: Unified Python packaging Ruff v0.6.0 Announcing the Astral OSS Fund Ruff v0.5.0 Ruff v0.4.5: Ruff's language server is now written in Rust Ruff v0.4.0: a hand-written recursive descent parser for Python Ruff v0.3.0 uv: Python packaging in Rust Ruff v0.2.0 Ruff v0.1.8 Ruff v0.1.5 The Ruff Formatter: An extremely fast, Black-compatible Python formatter
Ruff v0.7.0
alex@astral. · 2024-10-17 · via Blog - Astral

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.