build: pin ruff exactly and exclude Markdown from the formatter - #258
Merged
Conversation
ruff 0.16 began formatting Python code blocks inside Markdown, which 0.15 did not. With a `>=0.15.0` floor and fresh resolution in CI, that turned #246 red without any change to the branch — the same commit passed in May and failed in August. Pin exactly so a commit's verdict is stable over time. This does not stall upgrades: an exact pin is precisely the case where Dependabot opens a PR, so new ruff versions arrive as their own reviewable change instead of surfacing on unrelated branches. Dev-only, so nothing is imposed on consumers. Also exclude `*.md` from the formatter. Doc snippets are illustrative rather than compiled, and the formatter collapses hand-aligned trailing comments that make the examples scannable. Linting is unaffected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pins
ruffto==0.16.3and excludes*.mdfrom the formatter.Why pin
ruff 0.16 began formatting Python code blocks inside Markdown; 0.15 did not. With a
>=0.15.0floor and fresh resolution in CI, that turned #246 red without any change to the branch — the same commit passed in May and failed in August.A floating formatter means a commit's CI verdict is not stable over time. On a repo with 41 forks that lands asymmetrically: an outside contributor's PR goes red for something unrelated to their change, and the fix gets bundled into whatever work happened to be in flight.
Pinning does not stall upgrades. An exact pin is precisely the case where Dependabot opens a PR — a
>=floor gives it nothing to edit, which is why it has never proposed a ruff bump. So new versions still arrive and still flag latent issues; they just arrive as their own reviewable change.Dev-only dependency, so nothing is imposed on downstream consumers.
Why exclude Markdown
Doc snippets are illustrative rather than compiled, and the formatter collapses hand-aligned trailing comments that make the examples scannable:
Scoped to
[tool.ruff.format], so linting is unaffected.Testing
poetry run ruff format --check→ 12 files (was 13; README.md now excluded)poetry run ruff check→ all checks passedpoetry run pytest→ 30 passed🤖 Generated with Claude Code