Ruff v0.16.0
TL;DR · AI 摘要
Ruff v0.16.0大幅增加默认代码检查规则,从59增至413条,显著提升Python项目代码质量。
核心要点
- Ruff v0.16.0默认启用413条规则,较之前版本增加近7倍。
- 使用`uvx ruff@latest check . --fix --unsafe-fixes`可自动修复大部分问题。
- OpenAI收购Astral后,Ruff可能获得更多资源支持。
结构提纲
按章节快速跳转。
思维导图
用一张图看清主题之间的关系。
查看大纲文本(无障碍 / 无 JS 友好)
- Ruff v0.16.0更新
- 核心功能
- 新增413条默认规则
- 自动修复工具
- 实际影响
- 三大项目修复1618个错误
- OpenAI资源整合
金句 / Highlights
值得收藏与分享的关键句。
Ruff现在默认启用413条规则,较之前版本增加近7倍。
sqlite-utils项目使用自动修复后,1618个错误中1538个被解决。
OpenAI收购Astral后,Ruff可能获得更多资源支持。
Ruff v0.16.0
Simon Willison’s Weblog
Subscribe
#smallhead
Sponsored by:
Cursor — Delegate engineering tasks to Cursor Cloud Agents—even while your laptop is closed.
Try Cursor & get 50% off your first month
25th July 2026 - Link 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 , the number of rules in Ruff has grown from 708 to 968. Many of these rules catch severe issues, including syntax errors and immediate runtime errors 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:
uvx ruff@latest check .I ran the latest Ruff against my three biggest projects - Datasette , sqlite-utils , and LLM - 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:
uvx ruff@latest check . --fix --unsafe-fixesAgainst sqlite-utils , that command reported:
Found 1618 errors (1538 fixed, 80 remaining).As an illustrative example, here are three of the remaining issues. Ruff does a nice job of explaining each one:
DTZ005 `datetime.datetime.now()` called without a `tz` argument
--> tests/test_duplicate.py:17:10
|
15 | "datetime_col" TEXT)""")
16 | # Insert one row of mock data:
17 | dt = datetime.datetime.now()
| ^^^^^^^^^^^^^^^^^^^^^^^
18 | data = {
19 | "text_col": "Cleo",
|
help: Pass a `datetime.timezone` object to the `tz` parameter
BLE001 Do not catch blind exception: `Exception`
--> tests/test_plugins.py:16:12
|
14 | db.execute("select * from pragma_function_list()")
15 | return True
16 | except Exception:
| ^^^^^^^^^
17 | return False
18 | finally:
|
B018 Found useless attribute access. Either assign it to a variable or remove it.
--> tests/test_update.py:46:5
|
44 | def test_update_invalid_pk(fresh_db, pk, update_pk):
45 | table = fresh_db["table"]
46 | table.insert({"id1": 5, "id2": 3, "v": 1}, pk=pk).last_pk
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 | with pytest.raises(NotFoundError):
48 | table.update(update_pk, {"v": 2})
|Unsurprisingly, given Astral's new home at OpenAI , this output provides everything a coding agent would need to fix the problems.
I had Codex (GPT-5.6 Sol high) upgrade LLM and sqlite-utils , and Claude Code (with Opus 5) upgrade Datasette .
Posted
25th July 2026
at 10:44 pm
Recent articles
- OpenAI’s accidental cyberattack against Hugging Face is science fiction that happened - 22nd July 2026
- A Fireside Chat with Cat and Thariq from the Claude Code team - 21st July 2026
- Kimi K3, and what we can still learn from the pelican benchmark - 16th July 2026
#primary
This is a link post by Simon Willison, posted on 25th July 2026 .
python
1,268
ruff
7
astral
18
Monthly briefing
Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.
Pay me to send you less!
Sponsor & subscribe
.metabox
#secondary
#wrapper
- Disclosures
- Colophon
- ©
- 2002
- 2003
- 2004
- 2005
- 2006
- 2007
- 2008
- 2009
- 2010
- 2011
- 2012
- 2013
- 2014
- 2015
- 2016
- 2017
- 2018
- 2019
- 2020
- 2021
- 2022
- 2023
- 2024
- 2025
- 2026