Replace mypy type-check gate with ty (astral-sh) - #1
Merged
GiGiKoneti merged 1 commit intoJul 15, 2026
Merged
Conversation
21 tasks
sadamov
marked this pull request as ready for review
July 13, 2026 13:18
sadamov
force-pushed
the
chore/ty-type-checker
branch
2 times, most recently
from
July 13, 2026 14:11
9c00930 to
cd176fe
Compare
Swap the mypy pre-commit hook and [tool.mypy] config for ty, which resolves imports against the project venv and checks type correctness more thoroughly than mypy did with ignore_missing_imports. Migrate the mypy `# type: ignore[...]` comments to `# ty: ignore[<rule>]` (ty does not honour mypy's code-specific directives), rewrapping the few lines where ty's longer rule names would exceed the 80-char limit. Add [tool.ty] config downgrading the noisy possibly-missing-submodule rule and pointing ty at .venv. ty runs as a local pre-commit hook and in the install-and-test CI job (after uv sync); it is skipped in the deps-less linting CI job. mypy and the types-* stub dev deps are dropped from pyproject and uv.lock. Annotation-coverage enforcement (mypy's disallow_untyped_defs) is not offered by ty and moves to ruff's flake8-annotations (ANN) rules in mllam#614. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sadamov
force-pushed
the
chore/ty-type-checker
branch
from
July 13, 2026 14:16
cd176fe to
db756b3
Compare
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.
Describe your changes
Targets mllam#673 (not
main): replaces the mypy type-check gate that mllam#673 introduces withty(astral-sh).mirrors-mypypre-commit hook and[tool.mypy]config forty. Unlike mypy withignore_missing_imports,tyresolves imports against the project venv, so it type-checks against real torch/lightning/xarray types.# type: ignore[...]comments to explicit# ty: ignore[<rule>](ty does not honour mypy's code-specific directives); a few lines are rewrapped where ty's longer rule names would exceed the 80-char limit.[tool.ty]downgrades the noisypossibly-missing-submodulerule and pins the environment to.venv.tyruns as a local pre-commit hook and in theinstall-and-testCI job afteruv sync; it is skipped in the deps-less linting CI job (it needs the venv to resolve imports).types-*stub dev deps are dropped frompyproject.tomlanduv.lock.No dependencies at runtime.
Two coordination points:
tycurrently reports 2 findings, both thetrain_model.pymesh_up/down_gnn_typebug that Fix graph LAM GNN kwarg handling mllam/neural-lam#688 fixes. CI hard-fails until Fix graph LAM GNN kwarg handling mllam/neural-lam#688 merges and this rebases. Draft until then.tyhas nodisallow_untyped_defsequivalent, so it does not enforce that every function is annotated (the point of Enforce 100% type-hint coverage and align typing to PEP 585/604 mllam/neural-lam#673). That enforcement should move to ruff's flake8-annotations (ANN) rules in Modernize linting stack: migrate to Ruff and streamline pre-commit hooks mllam/neural-lam#614 (the codebase is alreadyANN-clean with--ignore ANN401). Until Modernize linting stack: migrate to Ruff and streamline pre-commit hooks mllam/neural-lam#614 lands withANN, coverage is achieved but ungated.Issue Link
refs mllam#670
Type of change
(Maintenance / CI-CD change - the Type-of-change list above has no maintenance option; see the CHANGELOG Maintenance entry.)
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee