Skip to content

Adopt the shared ruff rule set, configure ty, pin both - #6

Merged
pattonw merged 3 commits into
mainfrom
chore/ruff-ty-baseline
Nov 4, 2026
Merged

pattonw merged 3 commits into
mainfrom
chore/ruff-ty-baseline

Conversation

@pattonw

@pattonw pattonw commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

ruff

[tool.ruff.lint] selects E, F, W, I, UP, B (replacing the interim pin of ruff's old defaults), ignores E501 (the formatter owns line length), allows E402 in tutorials/examples and F401 in __init__.py. Two commits:

  1. Config plus ruff check --fix and ruff format, including the semantics-preserving unsafe fixes: zip(..., strict=False) made explicit (17 sites), Optional[X] → X | None, printf → f-string.
  2. By hand: the dimension assert in roi.py as an f-string, and the two blind pytest.raises(Exception) in test_questions.py now name what the call raises (TypeError, AssertionError).

ty

[tool.ty.src] include = ["src", "tests"]. ruff and ty are pinned with == in the dev group (0.17.3, 0.0.96) so the jobs stop drifting with releases. The four diagnostics were intentional misuse in tests (tuple and string arithmetic on Coordinate, a None offset for Roi); their mypy-era type: ignore comments become ty: ignore[<rule>] # intentional misuse.

Counters: 0 rules at warn, 4 ty: ignore comments, 0 excludes.

Verified locally

ruff check ., ruff format --check . and ty check all clean; pytest 15 passed, 1 xfailed.

🤖 Generated with Claude Code

pattonw and others added 3 commits November 3, 2026 15:58
[tool.ruff.lint] now selects E, F, W, I, UP and B (E501 left to the
formatter), with E402 allowed in tutorials/examples and F401 in
__init__.py. The rest of this commit is `ruff check --fix` (plus the
semantics-preserving unsafe fixes for `zip(strict=False)`, `X | None`
annotations and printf formatting) and `ruff format`.

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
- roi.py: f-string instead of printf formatting in the dimension assert.
- test_questions.py: the two blind `pytest.raises(Exception)` now name
  the exception the call raises (TypeError, AssertionError).

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
[tool.ty.src] names the checked scope (src, tests). ruff and ty are
pinned with == in the dev group so CI stops drifting with releases.
The four diagnostics were all intentional misuse in tests (tuple and
string arithmetic on Coordinate, a None offset for Roi); their mypy-era
`type: ignore` comments, which ty does not honour, become
`ty: ignore[<rule>]` with the reason.

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
@pattonw
pattonw merged commit a14df03 into main Nov 4, 2026
6 checks passed
@pattonw
pattonw deleted the chore/ruff-ty-baseline branch November 4, 2026 00:15
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