ty vs mypy, and how to switch without fixing old errors
ty 1.0 is faster than mypy and stricter by default; a baseline file lets CI fail only on new type errors.
Published here · 4 sources · Resume reading
ty is Astral's Python type checker written in Rust, and 1.0 shipped on 2026-12-01 as a faster, stricter alternative to mypy. [1] On the Python typing conformance suite it records 14 false positives and 13 false negatives against mypy's 190 and 109, and OpenAI's move to ty gave a median 24x speedup with 73% less peak memory, per Astral. [1]
The catch for a big codebase is the first run. ty checks the bodies of unannotated functions by default, which mypy skips unless you turn on check_untyped_defs, so expect more errors on day one. [4] A baseline file records those errors so CI only fails on new ones.
Related reading: race uv against pip on a cold cache install, update Python tooling after the eMudhra certificate incident and save GitHub Actions minutes with three workflow fixes. Browse the Dev tools topic.
Install ty and run it once
Astral's installation guide documents a global install with uv. [2]
uv tool install ty@latestRun the checker from the project root. [1]
ty checkBy default ty exits with code 1 if it reports any warning or error, which is what makes it fail a CI job. [3] To pin one version for the whole team instead, the docs add it as a dev dependency with uv add --dev ty and run it with uv run ty. [2]
Record today's errors in a baseline file
Point ty at a baseline file in pyproject.toml. The path is resolved against the project root. [3]
[tool.ty]
baseline = "ty-baseline.json"Warning: diagnostic baselines are in preview, and the docs say the file format may change between ty releases. [3] Regenerate the file after you upgrade ty.
Write the current diagnostics into it. [3]
ty check --update-baselineCommit ty-baseline.json. Astral's example shows the next ty check passing, while a new error in the same file still fails it. [1]
All checks passed!If you prefer suppression comments to a separate file, ty check --add-ignore adds them to the code in one pass. [1]
Translate your mypy settings
The migration guide maps mypy's settings to ty. [4]
- A line ignore such as
# type: ignore[code]becomes# ty: ignore[rule]. disable_error_codebecomes<rule> = "ignore"under[tool.ty.rules].- Severities are
ignore,warnanderror.
The configuration reference shows the rules table. [3]
[tool.ty.rules]
possibly-unresolved-reference = "warn"
division-by-zero = "ignore"ty has no mypy plugins. It ships built-in support for Pydantic, Django, pytest and attrs, and the guide says several mypy and Pyright checks are not implemented in ty yet, so check its rule mapping table for the codes you rely on. [1][4]
Let ty fix what it can
ty 1.0 applies its suggested fixes, such as removing a redundant cast, with one flag. [1]
ty check --fixAstral's example reports Found 1 diagnostic (1 fixed, 0 remaining). before the next check passes. [1] Review the diff like any other change before you commit it.
You now have ty installed, today's errors parked in a committed baseline, your mypy ignores translated, and a CI check that fails only when someone adds a new type error.
Send this to the Python teammate who keeps putting off the mypy upgrade.
Keep this guide
Filed under Dev tools
Questions about this guide
Is ty faster than mypy?
Astral reports that ty was the fastest type checker on 16 of 18 ecosystem projects in its benchmarks, and OpenAI's migration to ty gave a median 24x speedup and 73% less peak memory. Those are Astral's numbers.
Is ty ready for production?
Astral released ty 1.0 on 2026-12-01 and says it is ready to recommend it for production use for all users. The diagnostic baseline feature is still in preview.
Does ty support mypy plugins?
No. ty has no equivalent to mypy plugins. It has built-in support for Pydantic, Django, pytest and attrs instead.
What does a ty baseline file do?
It records the diagnostics your project has today, so ty check passes on those and still fails on any new error. You create or update it with ty check --update-baseline.
Sources
- Astral: ty 1.0astral.sh
- ty docs: installationdocs.astral.sh
- ty docs: configuration reference, baselinedocs.astral.sh
- ty docs: coming from mypy or pyrightdocs.astral.sh