feat(lint): replace mypy with ty type checker#1038
Open
Tranquility2 wants to merge 2 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1038 +/- ##
==========================================
- Coverage 83.29% 83.21% -0.09%
==========================================
Files 16 16
Lines 1754 1757 +3
Branches 193 194 +1
==========================================
+ Hits 1461 1462 +1
- Misses 236 237 +1
- Partials 57 58 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #1001
Swaps mypy for Astral's ty as the project's static type checker.
ty is ~20x faster on this codebase (0.25s vs 4.9s locally) and provides clearer diagnostics.
Tooling changes
pyproject.toml: dropmypy>=1andtypes-paramiko>=4from the lint dep group, addty.Replace the
[tool.mypy]block +[[tool.mypy.overrides]]entries with[tool.ty.*]blocks.unresolved-importandpossibly-missing-submoduleare set toignoreto preserve the previousignore_missing_importsbehavior fordocker/wrapt/requests/registry.Makefile: replacemypy-core/mypy-core-reportwithty-core..pre-commit-config.yaml: swap the local mypy hook for a local ty hook..github/workflows/ci-lint.yml: runmake ty-core.scripts/mypy_report.py: removed (no longer needed; ty's own output is concise).README.md: add ty badge.Code fixes for diagnostics surfaced by ty
container._transfer_into_container: defaultmode=0o644to matchwith_copy_into_container.container.get_wrapped_container/image.get_wrapped_image: annotate return asOptional[...](they can beNonebeforestart()).wait_strategies._get_status_tc_container: raiseContainerStartExceptionwhen the container is not started instead of dereferencingNone.waiting_utils: usegetattr(self.func, "__name__", repr(self.func))for safer error messages.# ty: ignore[...]for the hasattr-guardedadd_note, the Protocol-narrowedcontainer.execcall, the kwargs unpack into docker-py, and the wrapt decorator cast.Verification
uv run ty check core/testcontainers→ All checks passed!make ty-core→ passesuv run pytest -q core/tests→ 121 passed