Astral released ty 1.0.0 on 1 December 2026. It’s the first stable version of its Rust-based Python type checker and language server. The announcement says the team is “ready to recommend it for production use, for all users”. It also says ty is now the default type checker at OpenAI.
If you already use uv or Ruff, ty fits the same workflow. This guide shows how to install it, run it on a real project, roll it out to an existing codebase without drowning in errors, and turn on the opt-in features that make 1.0 interesting. I ran every command below with ty 1.0.0 on CPython 3.13.
What’s new in 1.0
From the release notes:
- Speed: Astral’s benchmarks put ty first on 16 of 18 CLI benchmark projects, 1.46× faster than Pyrefly and 3.56× faster than Zuban by geometric mean.
- Conformance: ty passes 95% of test files in Python’s typing conformance suite, up from 29% at the beta (Astral lists mypy at 57%).
- Better inference: a new generics solver, stronger bidirectional inference, and opt-in return type inference for unannotated functions.
- Library support: built-in understanding of Pydantic, Django, attrs and pytest.
- Adoption tools:
--fix,--add-ignoreand diagnostic baselines (preview). - Editor features: Go to Implementation, call and type hierarchies, and renaming files and packages.
Install and run
# As a global tool
uv tool install ty@latest
ty --version # ty 1.0.0
# Or per project, as a dev dependency
uv add --dev ty
uv run ty check
ty check with no arguments checks the project root. Pass files or folders to narrow it down. If you’re not using uv’s .venv, point ty at your interpreter so it can resolve third-party imports:
ty check --python .venv src/
For editors, install the official VS Code extension or point any LSP client at ty server.
A first real error
ty carries types through code that other checkers often lose track of. Here’s the TypedDict example from Astral’s announcement, which I ran myself:
from typing import TypedDict
class Runner(TypedDict):
name: str
seconds: float
def podium(runners: list[Runner]) -> list[Runner]:
ranked = sorted(
[*runners, {"name": "Ada", "seconds": 53.2}],
key=lambda runner: runner["second"],
)
return ranked[:3]
$ ty check podium.py
error[invalid-typed-dict-key]: Unknown key "second" for TypedDict `Runner`
--> podium.py:12:35
|
12 | key=lambda runner: runner["second"],
| ------ ^^^^^^^^ Did you mean "seconds"?
| |
| TypedDict `Runner`
help: Replace with "seconds"
...
note: This is an unsafe fix and may change runtime behavior
Found 1 diagnostic
ty works out that the literal dict for Ada is a Runner too, carries that type into the lambda, and suggests the correct key. The exit code was 1, so this fails a CI job as you’d expect.
Pydantic models are understood
With 1.0, ty knows about Pydantic field aliases and strict fields. In my test (with pydantic installed in the environment I passed through --python):
from pathlib import Path
from pydantic import BaseModel, Field
class Options(BaseModel):
output: Path
simulate: bool = Field(default=False, strict=True, alias="dry_run")
Options(output="./exports", dry_run=True) # OK: alias, and str -> Path is allowed
Options(output="./exports", dry_run="true") # error
error[invalid-argument-type]: Argument is incorrect
--> options.py:12:29
|
12 | Options(output="./exports", dry_run="true")
| ^^^^^^^^^^^^^^ Expected `bool`, found `Literal["true"]`
Note that ty accepted a string for the Path field, which Pydantic converts, and only flagged the strict boolean. The Django, attrs and pytest integrations work the same way. See the third-party support docs.
Turn on return type inference
By default, ty treats the return type of an unannotated function as Unknown, which hides a lot of bugs in older code. 1.0 adds an opt-in setting:
# pyproject.toml
[tool.ty.analysis]
return-type-inference = "always"
(Use [analysis] in a standalone ty.toml.) Take this unannotated helper:
def label(order_id: int):
if order_id > 0:
return f"order-{order_id}"
return None
name = label(5)
print(name.upper())
With the default setting, ty check printed All checks passed!. With return-type-inference = "always", it reported:
error[missing-union-attribute]: Attribute `upper` is not defined on `None` in union `str | None`
--> orders.py:12:7
The docs note that explicit annotations always win, and that generator and async functions aren’t inferred yet.
Adopting ty on an existing codebase
Turning on a new checker in a large repo usually produces hundreds of errors. ty 1.0 gives you three ways to handle that.
1. Suppress what exists today
ty check --add-ignore .
This adds ty: ignore[...] comments for every current diagnostic. On my small test project it printed Added 2 ignore comments, and the line became:
print(name.upper()) # ty: ignore[missing-union-attribute]
The next ty check passed, so CI is green and any new error fails the build.
2. Use a baseline instead of comments (preview)
If you don’t want comments scattered through the code, keep a baseline file:
[tool.ty]
baseline = "ty-baseline.json"
ty check --update-baseline # create or refresh it
ty check # only new diagnostics fail
Baselines are in preview, and the docs warn that the file format may change between releases.
3. Apply automatic fixes
ty check --fix applies the fixes ty considers safe. Fixes marked unsafe, like the TypedDict key suggestion above, are shown but need your review.
Tune rules and strictness
Rules are configured per name, with ignore, warn or error:
[tool.ty.rules]
possibly-unresolved-reference = "warn"
division-by-zero = "ignore"
By default ty exits with code 1 on any warning or error. Set terminal.error-on-warning = false if warnings shouldn’t fail CI. For stricter teams, 1.0 adds strict-generic-narrowing and strict-equality-semantics under [tool.ty.analysis], plus rules like unsound-return, missing-type-argument, disjoint-cast and redundant-condition. See the configuration reference.
A GitHub Actions job
name: types
on: [push, pull_request]
jobs:
ty:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10
- run: uv sync --dev
- run: uv run ty check
Check the latest major versions of the actions before you copy this.
Should you switch from mypy or Pyright?
If speed in CI and the editor matters to you, or you already use uv and Ruff, ty 1.0 is now a serious default. A sensible path is to run ty alongside your current checker for a sprint, use --add-ignore or a baseline to start clean, then compare what each one reports. ty respects type: ignore comments by default, which makes running both side by side easier.
Takeaways
- ty 1.0.0 is stable and production-ready according to Astral. Install it with
uv tool install ty@latest. - Enable
return-type-inference = "always"to catch bugs in unannotated code. - Use
--add-ignoreor a baseline to adopt it on legacy code without a giant cleanup first. - Pydantic, Django, attrs and pytest support is built in.
Sources: ty 1.0.0 release, ty 1.0 announcement, ty documentation.
