ty vs mypy comes down to speed and maturity. ty is Astral's Rust type checker and language server, production-ready since its 1.0 release on December 1, 2026. mypy is the reference checker with the deepest plugin ecosystem, and Pyright is Microsoft's fast checker behind Pylance in VS Code. Pick ty for speed on new projects, mypy for plugin-heavy codebases, and Pyright if your team lives in VS Code.
All three catch the same everyday bugs. None of them can check the JSON your API actually returns, and for backend developers that gap matters more than any benchmark.
What is ty?
ty is an open-source Python type checker and language server from Astral, the team behind uv and Ruff. It's written in Rust, built around incremental checking for fast editor updates, and ships a CLI (ty check) plus a VS Code extension. Astral declared it ready for production use with ty 1.0 on December 1, 2026.
You can try it without installing anything into your project:
uvx ty check
# or install it as a tool
uv tool install ty@latest
ty 1.1.0 followed on PyPI on December 3. The ty 1.0 announcement says ty is now the default type checker at OpenAI, where migrating brought a median 24x speedup and 73% less peak memory.
ty vs mypy vs Pyright at a glance
| ty | mypy | Pyright | |
|---|---|---|---|
| Maintainer | Astral | Python community (python/mypy) | Microsoft |
| Written in | Rust | Python (compiled with mypyc) | TypeScript (runs on Node.js) |
| Latest version (Dec 4, 2026) | 1.1.0 | 2.4.1 | 1.1.414 |
| Install | uv tool install ty |
pip install mypy |
npm i -g pyright or pip install pyright
|
| Language server | Yes, built in | No official one (dmypy daemon for speed) | Yes, also powers Pylance |
| Plugin system | No; built-in support for Pydantic, Django, pytest, attrs | Yes (Pydantic, django-stubs and more) | No |
| Autofix | ty check --fix |
No | No (editor quick fixes only) |
| Adopting a legacy codebase |
--add-ignore, --update-baseline
|
Per-module config, # type: ignore
|
Per-file # pyright: basic or strict |
Versions come from PyPI and npm on December 4, 2026. The rest comes from each project's docs: ty, mypy and Pyright.
Same file, three type checkers
Here's one small API client with two bugs, a typo in a TypedDict key and an int + str, checked by all three on the same machine.
from typing import TypedDict
import httpx
class User(TypedDict):
id: int
email: str
def get_user(base_url: str, user_id: int) -> User:
resp = httpx.get(f"{base_url}/users/{user_id}", timeout=5)
resp.raise_for_status()
return resp.json()
def greeting(user: User) -> str:
return "Hello " + user["emial"]
def total_users(users: list[User]) -> int:
return len(users) + "0"
ty 1.1.0 (ty check client.py) finds both bugs and offers a fix for the typo:
error[invalid-typed-dict-key]: Unknown key "emial" for TypedDict `User`
--> client.py:18:28
help: Replace with "email"
error[unsupported-operator]: Unsupported `+` operation
--> client.py:22:12
Found 2 diagnostics
mypy 2.4.1 (mypy client.py) finds the same two, also with a suggestion:
client.py:18: error: TypedDict "User" has no key "emial" [typeddict-item]
client.py:18: note: Did you mean "email"?
client.py:22: error: Unsupported operand types for + ("int" and "str") [operator]
Found 2 errors in 1 file (checked 1 source file)
Pyright 1.1.414 (pyright client.py) agrees:
client.py:18:23 - error: Could not access item in TypedDict
"emial" is not a defined key in "User" (reportGeneralTypeIssues)
client.py:22:12 - error: Operator "+" not supported for types "int" and "Literal['0']"
2 errors, 0 warnings, 0 informations
Notice what all three accepted in default mode: return resp.json(). That call returns Any, and Any passes for a User. Only stricter settings notice it. mypy --strict reports Returning Any from function declared to return "User", and ty check --warn unsound-return reports `Any` is not a subtype of `User`. Even then, the checker only tells you the value is unchecked. It can't tell you whether the server really sends email.
Speed and correctness: what the numbers say
Astral's benchmarks put ty first on 16 of 18 open-source projects for a cold command-line check, 1.46x faster than Pyrefly and 3.56x faster than Zuban by geometric mean. In the editor, ty was the fastest language server on 14 of 17 projects. These are Astral's numbers on an M3 Max, so run your own repo before you quote them to your team.
On the Python typing conformance suite, ty 1.0 records 14 false positives and 13 false negatives, down from 224 and 405 at its beta. Astral's post puts mypy at 190 false positives and 109 false negatives on the same suite. Conformance is an imperfect proxy for real code, but it shows ty is no longer a toy.
In Astral's November audit of the 25,000 most-downloaded PyPI packages, 11.6% of repositories with a type checker used ty, third behind mypy and Pyright. FastAPI and tox already use it.
mypy vs Pyright vs ty: which one should you use?
Your codebase decides more than the benchmark does.
- Pick ty for new projects, uv-based repos and large monorepos where check time hurts. You get autofix, a baseline file for gradual adoption and built-in Pydantic and Django support with no plugin setup. PEP 723 script support exists but is still in preview.
- Pick mypy if you depend on plugins. The Pydantic mypy plugin, django-stubs and many internal plugins only run on mypy. It's also the checker most typing tutorials and CI templates assume.
- Pick Pyright if your team already runs VS Code with Pylance. The editor and CI see the same diagnostics, and its strict mode is well documented.
You don't have to choose once and forever. A common setup is ty in the editor for instant feedback and your existing checker in CI until ty's output matches what you trust. If you run FastAPI services, pair any of the three with real tests; our guide to unit testing FastAPI covers the runtime side.
What no type checker can see: the API boundary
A type checker reads your source code. It never sees an HTTP response. When you annotate get_user() as returning User, you're making a promise about a server you don't control, and ty, mypy and Pyright all take that promise at face value.
That's where backend bugs actually hide. The server renames email to email_address, makes id a string, or drops a field on one code path. Your code still type checks. It fails in production with a KeyError.
Two habits close the gap:
- Generate your TypedDict or Pydantic models from the API spec instead of writing them by hand.
- Run contract tests against the real endpoint, so the response is checked against the same spec at runtime.
Both steps are tedious by hand. They're perfect work for a coding agent.
Let your coding agent check the contract with Apidog CLI
Apidog CLI gives your coding agent (Claude Code, Codex, OpenCode or Cursor) direct access to your Apidog project: endpoints, data schemas, test cases and test runs, all as JSON. The agent reads the spec, writes typed models that match it, runs your type checker, then runs the contract tests. You write one prompt.
Setup (once per machine):
npm install -g apidog-cli@latest
apidog auth login
apidog skill install # teaches your agent the apidog commands
The installation guide covers tokens and CI. If you use Claude Code, see Apidog CLI in Claude Code.
The prompt:
Read the data schemas in Apidog project <projectId> with the apidog CLI.
Generate a TypedDict for each one in models.py and type the /objects
client against them. Run `ty check --warn unsound-return` and fix every
diagnostic. Then run the /objects test cases against environment <envId>
and tell me any field where the live response disagrees with the schema.
What the agent runs:
apidog schema list --project <projectId>
apidog schema get <schemaId> --project <projectId>
ty check --warn unsound-return
apidog run --test-case <testCaseId> --project <projectId> -e <envId> -r cli,json
The schema the agent reads becomes the TypedDict your type checker enforces, and apidog run checks the live responses against that same schema. Add --upload-report to see the run in the Apidog app, or wire the same command into CI with the apidog run reference.
Once one agent does this reliably, a team can hand these runs out as tasks. Sharkly is a board where you assign that work to coding agents running on your own machines with your own Claude Code or Codex plan, run several in parallel and review what they ship before it merges. It's free to start.
How to migrate from mypy or Pyright to ty
ty 1.0 added the two features that make migration safe on a real codebase.
-
Install and run it next to your current checker.
uvx ty checkgives you a first count without touching CI. -
Point it at your environment. Pass
--python .venv(or let uv discover it) so third-party imports resolve. -
Silence the backlog. Run
ty check --add-ignoreto add suppression comments in one pass, orty check --update-baselineto record existing diagnostics inty-baseline.json. Commit the baseline so CI flags only new errors. -
Turn on the rules you relied on. If you ran
mypy --strict, start with--warn unsound-return. Use--error <RULE>to make a rule fail the build. -
Apply safe fixes.
ty check --fixremoves things like redundant casts automatically. -
Swap the CI step last. For GitLab,
--output-format gitlabemits Code Quality JSON.
Keep mypy in CI for any module that depends on a mypy plugin until you've confirmed ty's built-in support covers it.
FAQ
Is ty ready for production? Yes, according to Astral. ty 1.0 shipped on December 1, 2026 with a recommendation for production use, and it's the default checker at OpenAI. Run it beside your current checker for a sprint before you switch CI.
Is ty faster than mypy? In Astral's benchmarks, yes, by a wide margin, and OpenAI reported a median 24x speedup after migrating. Results depend on your codebase and cache, so time ty check against your own repo.
Does ty replace Pyright and Pylance in VS Code? It can. ty ships its own language server and a VS Code extension, so you can use it for completions, navigation and diagnostics instead of Pylance. Disable one language server so you don't see duplicate errors.
Does ty support Pydantic and Django? Yes. ty 1.0 has built-in support for Pydantic, Django, pytest and attrs, without the plugin setup mypy needs.
Can a type checker validate API responses? No. ty, mypy and Pyright only check source code. Validate responses at runtime with Pydantic and check the API contract with tests, for example by having your coding agent run Apidog test cases with apidog run.



Top comments (0)