Skip to content

Adopt the shared ruff rule set and configure ty - #45

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
Contributor

ruff

[tool.ruff.lint] selects E, F, W, I, UP, B (was F, W, I001), 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 (19 sites), Optional[X] → X | None (114), printf → f-string.
  2. The hand fixes: LazyOp as a | union; __sql_type's except clause caught ValueError but the dict lookup raises KeyError, so it never fired (now except KeyError ... from None); is True/is False in tests; the bare except: names the two exceptions it handles; six blind pytest.raises(Exception) carry a noqa with the reason (the duplicate-write error is backend-specific).

ty

[tool.ty.src] include = ["src", "tests"]. The mypy overrides table and types-networkx/types-toml are gone; types-psycopg2 stays because psycopg2 ships no inline types. Of the ten diagnostics that kept the job red: to_world_space now declares the ndarray it returns for plain sequences, the PostgreSQL info query asserts fetchone() returned a row, psycopg2.errors is imported explicitly, and the mypy-era type: ignore comments ty does not honour (OME metadata construction, lazy-op narrowing, iohub's AxisMeta alias) become ty: ignore[<rule>] with reasons. The pre-commit ruff hook moves to v0.17.3 and gains ruff-format.

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

Verified locally

ruff check ., ruff format --check . and ty check all clean; pytest tests 134 passed, 29 skipped (PostgreSQL tests need the service).

🤖 Generated with Claude Code

pattonw and others added 3 commits November 3, 2026 16:13
[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>
- lazy_ops.py: `LazyOp` as a `|` union instead of `typing.Union`.
- array.py: f-string in the chunk-alignment assert.
- pgsql_graph_database.py: the `__sql_type` lookup raises KeyError, not
  ValueError, so the except clause never fired; it now catches KeyError
  and raises NotImplementedError `from None` as intended.
- tests: `is True`/`is False` instead of `==`; the bare `except:`
  around the element-wise comparison names the two exceptions it
  handles; the six blind `pytest.raises(Exception)` carry a noqa with
  the reason (the duplicate-write error is backend-specific).

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
[tool.ty.src] names the checked scope (src, tests). The mypy overrides
table and types-networkx/types-toml are gone (types-psycopg2 stays:
psycopg2 ships no inline types and ty reads the stub). Of the ten
diagnostics: to_world_space's return annotation now includes the
ndarray it returns for plain sequences; the PostgreSQL info query
asserts fetchone() returned a row; psycopg2.errors is imported
explicitly; the mypy-era `type: ignore` comments on the OME metadata
construction, the lazy-op narrowing and the iohub AxisMeta alias become
`ty: ignore[<rule>]` with their reasons; the networkx overload ignore
is no longer needed without the stub package. The pre-commit ruff hook
moves to v0.17.3 and gains ruff-format.

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
@pattonw
pattonw force-pushed the chore/ruff-ty-baseline branch from f026a1d to 0cc5d50 Compare November 4, 2026 00:13
@pattonw
pattonw merged commit 6bae3a6 into main Nov 4, 2026
5 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