chore: 🔧 enforce type checking with ty (fixes #16) - #37
Open
pgrobasillobre wants to merge 1 commit into
Open
pgrobasillobre wants to merge 1 commit into
pgrobasillobre wants to merge 1 commit into
Conversation
Adopts ty as the type checker, replacing the dead [tool.pyright] block (never invoked anywhere) with a working [tool.ty] config, wired into prek.toml. ty keeps the toolchain consistent with the project's existing uv/ruff setup. Silences the expected unresolved-import diagnostic on the optional cupy dependency, and tightens loose annotations: dtype: type becomes numpy.typing.DTypeLike, and the bare NDArray in utils/linalg.py now carries its generic parameter. Also fixes a genuine, separate deprecated-API warning found along the way in logging_config.py. Full details, including a known out-of-scope finding and a local-only environment note, in the PR description. Assisted-by: claude.ai:claude-sonnet-5
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.
🤖 AI text below 🤖
Adopts
tyas the type checker, replacing the dead[tool.pyright]block (never invoked anywhere) with a working
[tool.ty]config,wired into
prek.toml. Keeps the toolchain consistent with theproject's existing
uv/ruffsetup.Silences the expected
unresolved-importon the optionalcupydependency, tightens
dtype: type→numpy.typing.DTypeLike(6x),and gives the bare
NDArrayinutils/linalg.pyits genericparameter. Also fixes a genuine, separate deprecation found along the
way in
logging_config.py.Note: the issue mentions
.pre-commit-config.yaml, but this repouses
prek.toml— thetyhook was added there instead. No changeneeded in
lint.yml, since it already runsprek.Known, out-of-scope finding:
ty checksurfaced 8 morediagnostics beyond the
cupyone mentioned in the issue —eta = [None] * n_sitesfilled via a loop, whichty's static analysiscan't fully verify across a dynamic loop range, though the code and
tests are correct. Suppressed with targeted ignores; a proper fix
(local-variable capture + an
assertbefore the final return) is agood follow-up, but touches working numerical code and felt out of
scope here.
Local-only note:
prek run --all-filesanduv sync --all-groups --all-extrasboth fail here (macOS/Apple Silicon) oncupy-cuda12x, which has no arm64 wheel. Confirmed this doesn'taffect CI, which runs on
ubuntu-latest.tyvsmypy: went withtyfor toolchain consistency,understanding it's pre-1.0 (per the issue's own caveat). Happy to
switch if preferred.
Testing:
uv run ty check src/,uv run ruff check src/ tests/,uv run ruff format --check src/ tests/,uv run pytest -m "not slow",and
uv run pytest(full suite) all pass locally.AI/LLM disclosure