Programming

ty 1.0: a fast type checker that finds Python bugs before you run the code

On December 1, 2026, Astral released the stable 1.0 version of ty, its Python type checker written in Rust. Learn what it catches and how to try it on your own project.

What a type checker catches

Python is dynamic: mistakes such as reading a key that does not exist in a dictionary usually appear only at runtime, sometimes in front of users. A static type checker uses annotations and inference to point them out in advance.

ty 1.0 ships a new generics solver and bidirectional type inference. In the example below, ty infers on its own that the dictionary added for Ada is a Runner and catches the wrong key name in the sort key.

Pythonpodium.py
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]

The real output of the example

When we ran this example with ty 1.0.0, it reported an invalid-typed-dict-key error: Runner has no key named second, line 12 gets a suggestion to use seconds, and 1 diagnostic is found in total.

According to the source, ty check --fix can apply some fixes automatically. For this example, however, ty marks the fix as unsafe, so it is better to review and accept it by hand.

How to adopt it in an existing project

A large project may already have many errors. ty check --add-ignore generates suppression comments for existing diagnostics, while diagnostic baselines (in preview) record old errors in a separate file so CI flags only new ones.

Practical step: install ty with uv tool install ty@latest, run ty check on a small project of your own, read and fix the first three diagnostics, and compare the result with mypy or Pyright.

Recommended reading

All articles