Skip to content

chore(deps): move the vendored Ruff to 0.17.3 - #584

Merged
JuroOravec merged 2 commits into
mainfrom
chore/ruff-0.17.3
Nov 2, 2026
Merged

JuroOravec merged 2 commits into
mainfrom
chore/ruff-0.17.3

Conversation

@JuroOravec

@JuroOravec JuroOravec commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Moves the vendored Ruff in third_party/rust/ruff from 0.16.6 (22f65a2ab, 2026-09-03) to 0.17.3 (ba65abf8b, 2026-10-26). 0.17.3 is Ruff's newest release; scripts/ruff_submodule_updates.py check now reports "In sync".

What changed for Citry

  • Workspace dependencies. The Ruff crates take their dependency versions from Citry's root Cargo.toml, so the new ones Ruff 0.17 uses are added there: url, web-time, icu_normalizer, hashbrown, phf/phf_codegen, and Ruff's own ruff_unicode_names2 crates. Ruff's crates replace the crates.io unicode_names2, and their Unicode data files ship in the citry-core sdist (checked with maturin sdist). char_str, get-size2, quick-junit and salsa move to the versions Ruff now needs.
  • The Python parser grows its stack again. Ruff 0.17.1 turned the parser's stack growth into an opt-in stacker feature (astral-sh/ruff#29505). Every Ruff binary turns it on, so Citry does too, in the root ruff_python_parser entry. Deeply nested template expressions keep the protection they had before.
  • Rust 1.97 is now the minimum (it was 1.96). Ruff 0.17 calls integer methods that are new in Rust 1.97 (astral-sh/ruff#29048). The workspace rust-version, the toolchain and distribution validators and their tests, every CI RUSTUP_TOOLCHAIN pin, pyodide-build.json, and the docs move to 1.97. I checked locally that citry_core_py builds with Rust 1.97.0. The archived 0.6.0 docs and older changelog entries keep 1.96.
  • python_safe_eval code changes for renamed Ruff APIs. A comparison stores all of its operands in one operands list, and the sandbox walks every item in it, which covers the left side as well. Iterating an f-string mutably now gives FStringPartMut. Call arguments are now a ThinVec. TokenKind::Name is now TokenKind::Identifier.
  • Formatter provider identity is now [email protected]+ba65abf8ba (the constant, the golden-corpus index, the Python, LSP and citry format tests, and the design docs).
  • zip stays at 8.6.0 because Ruff 0.17.3 still pins zip 8, so the deny.toml entries stay until a Ruff release moves to zip 9 (Remove the zip 8 advisory exceptions once vendored ruff moves to zip 9 #378). A newer zip advisory, RUSTSEC-2026-0429, fails rust-audit on main as well as here. build(deps): apply the open Dependabot updates for setup-uv, ty, and the JS tools #582 adds it to deny.toml, so this check passes once build(deps): apply the open Dependabot updates for setup-uv, ty, and the JS tools #582 merges.

Formatting differences users will see

One. Ruff 0.16.7 (astral-sh/ruff#28259) writes a string inside a nested f-string format field with the other quote character:

f"{v:{d["n"]}}"   # before: left as written (runs only on Python 3.12+)
f"{v:{d['n']}}"   # now

The golden corpus had no such case, so this PR adds expressions/nested-format-quotes. Its expected file holds the output observed from this build, and the corpus test fails if the expected file holds the old output. The citry-core changelog records the change.

Nothing else changed. The rest of the corpus passes unchanged, and 24 extra templates formatted the same with the 0.16.6 and 0.17.3 builds. They cover trailing pragma comments that push a line past the width (Ruff 0.17.0 leaves those comments out of line length), comparison chains, f-strings, lambdas and long calls. Citry still pins Python 3.10 for formatting. Ruff's new default Python version only affects Ruff's list of syntax a given Python version does not support, which Citry does not read.

One message changes: a Python syntax error in a template expression says found identifier where it said found name. The citry-core changelog records this and the Rust 1.97 requirement.

Security

python_safe_eval is the expression sandbox, so an independent reviewer checked it against both builds. The probes covered comparison chains with __import__, attributes, calls, lambdas or walrus in every position; f-strings with implicit concatenation, nested format fields and debug text; t-strings; and full-width look-alike names (eval). Every operand was still intercepted, and the generated code matched 0.16.6. Depth limits gave the same accept/reject results near the limit.

Checks run

  • cargo test -p python_safe_eval -p citry_template_parser -p citry_template_formatter: 1041 passed; after the corpus case was added, the formatter and safe_eval tests passed again (421).
  • cargo clippy --no-deps ... --all-targets -D warnings and cargo fmt --check for those crates plus citry_core_py: clean.
  • cargo check -p citry_core_py -p citry_template_formatter with Rust 1.97.0: passes.
  • Python: the formatter, safe_eval, distribution artifact, citry format, LSP project and toolchain validator tests: 612 passed. scripts/validate.py: all pass.
  • I did not run the full repository gate or the docs build. The formatter does not feed the docs build, and the only docs change is the version number on the compatibility page.

🤖 Generated with Claude Code

JuroOravec and others added 2 commits November 2, 2026 14:46
Move third_party/rust/ruff from Ruff 0.16.6 (22f65a2ab) to the latest
release, 0.17.3 (ba65abf8b).

- Mirror the workspace dependencies the Ruff crates now inherit from the
  root Cargo.toml: url, web-time, icu_normalizer, hashbrown, phf and
  phf_codegen, Ruff's own ruff_unicode_names2 crates (they replace the
  crates.io unicode_names2), and newer char_str, get-size2, quick-junit
  and salsa.
- Turn on ruff_python_parser's "stacker" feature. Ruff 0.17.1 made the
  parser's stack growth opt-in, and every Ruff binary enables it, so
  deeply nested expressions keep the protection they had before.
- Raise the Rust minimum from 1.96 to 1.97, which Ruff 0.17 needs, in the
  workspace, the validators, the CI toolchain pins and the docs.
- Adapt python_safe_eval to the renamed AST and token APIs (comparison
  operands, mutable f-string parts, compact call arguments, and
  TokenKind::Identifier).
- Update the formatter's provider identity to [email protected]+ba65abf8ba.

Citry's formatter output is unchanged on the golden corpus and on
extra probes. Ruff's syntax errors now say "identifier" where they said
"name".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ruff 0.16.7 (astral-sh/ruff#28259) writes a string inside a nested
f-string format field with the other quote character, so
f"{v:{d["n"]}}" becomes f"{v:{d['n']}}". Add a golden case for it,
record it in the citry-core changelog, and clarify three comments
from the review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec merged commit fe06660 into main Nov 2, 2026
29 of 35 checks passed
@JuroOravec
JuroOravec deleted the chore/ruff-0.17.3 branch November 2, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant