Astral 于 7 月 23 日发布 Python 代码检查工具 Ruff v0.16.0,默认启用规则从 59 条增至 413 条,覆盖语法错误和运行时错误等严重问题。
作者在 Datasette、sqlite-utils 和 LLM 三个项目上运行后共发现 1618 个错误,其中 1538 个可通过 `--fix --unsafe-fixes` 自动修复。
Ruff v0.16.0:https://astral.sh/blog/ruff-v0.16.0。Astral 在几天前的 7 月 23 日发布了他们的 Ruff Python 代码检查工具的重要新版本。我今天才注意到,因为我的各种 CI 作业开始失败,这是由于新的默认 Ruff 检查和我未固定版本的 "ruff" 开发依赖引起的。
摘自 Brent Westbrook 的公告文章:
Ruff 现在默认启用了 413 条规则,而之前版本为 59 条。
自从 Ruff 的默认规则集在 v0.1.0:https://github.com/astral-sh/ruff/blob/main/changelogs/0.1.x.md#breaking-changes 中最后一次修改以来,Ruff 的规则数量已从 708 条增加到 968 条。其中许多规则可以捕获严重问题,包括语法错误:https://docs.astral.sh/ruff/rules/load-before-global-declaration 和立即运行时错误:https://docs.astral.sh/ruff/rules/yield-in-init/,但以前默认并未开启。使用新的规则集,Ruff 将在无需任何配置的情况下提醒你这些问题及其他许多问题。
以下是一行命令,用于在任何 Python 项目上尝试:
我在我的三个最大项目上运行了最新的 Ruff——Datasette:https://datasette.io/、sqlite-utils:https://sqlite-utils.datasette.io/ 和 LLM:https://llm.datasette.io/——它发现了数百个违反新默认规则的小问题。
这三个项目都拥有非常全面的测试套件,在 CI 中运行,支持 Python 3.10 到 Python 3.14,因此这样的升级相当安全。以下命令完成了大部分升级工作:
在 sqlite-utils 上,该命令报告:
作为一个示例,下面是三个剩余的问题。Ruff 对每个问题的解释都相当不错:
不足为奇的是,考虑到 Astral 现在的新家在 OpenAI:https://simonwillison.net/2026/Mar/19/openai-acquiring-astral/,这一输出为编程智能代理提供了解决问题所需的所有信息。
我让 Codex(GPT-5.6 Sol 高级版)升级了 LLM:https://github.com/simonw/llm/pull/1557 和 sqlite-utils:https://github.com/simonw/sqlite-utils/pull/814,而让 Claude Code(带 Opus 5)升级了 Datasette:https://github.com/simonw/datasette/pull/2857。
这是 Simon Willison 于 2026 年 7 月 25 日发布的链接文章:/2026/Jul/25/。
每月赞助我10美元,即可获得本月最重要的大型语言模型发展的精选电子邮件摘要。
Ruff v0.16.0:https://astral.sh/blog/ruff-v0.16.0 . Astral shipped a significant new version of their Ruff Python linting tool a few days ago on July 23rd. I noticed today because my various CI jobs all started failing thanks to new default Ruff checks and my unpinned "ruff" dev dependency.
From Brent Westbrook's announcement post:
Ruff now enables 413 rules by default, up from 59 in previous versions.
Since Ruff's default rule set was last modified in v0.1.0:https://github.com/astral-sh/ruff/blob/main/changelogs/0.1.x.md#breaking-changes, the number of rules in Ruff has grown from 708 to 968. Many of these rules catch severe issues, including syntax errors:https://docs.astral.sh/ruff/rules/load-before-global-declaration and immediate runtime errors:https://docs.astral.sh/ruff/rules/yield-in-init/ but were not previously enabled by default. With the new rule set, Ruff will bring these issues and many others to your attention without any Ruff configuration.
Here's a one-liner for trying it on any Python project:
I ran the latest Ruff against my three biggest projects - Datasette:https://datasette.io/, sqlite-utils:https://sqlite-utils.datasette.io/, and LLM:https://llm.datasette.io/ - and it found hundreds of minor issues that breached the new default rules.
All three projects have very comprehensive test suites, executed in CI against Python 3.10 through Python 3.14, so upgrades like this are pretty safe. The following command did the bulk of the upgrades:
Against sqlite-utils , that command reported:
As an illustrative example, here are three of the remaining issues. Ruff does a nice job of explaining each one:
Unsurprisingly, given Astral's new home at OpenAI:https://simonwillison.net/2026/Mar/19/openai-acquiring-astral/, this output provides everything a coding agent would need to fix the problems.
I had Codex (GPT-5.6 Sol high) upgrade LLM:https://github.com/simonw/llm/pull/1557 and sqlite-utils:https://github.com/simonw/sqlite-utils/pull/814, and Claude Code (with Opus 5) upgrade Datasette:https://github.com/simonw/datasette/pull/2857.
This is a link post by Simon Willison, posted on 25th July 2026:/2026/Jul/25/.
Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.