← Tue, Dec 1 digest

Ty 1.0: Fast Python type checker and language server

read article ↗ hn thread ↗

Astral has released Ty 1.0, a fast Rust-written Python type checker and language server featuring built-in support for major frameworks and fine-grained incrementality.

read it Essential reading for Python developers tracking high-performance tooling alternatives to mypy and Pyright.

summary

Astral announced the 1.0 release of Ty, a Rust-based Python type checker and language server designed for extreme performance and fine-grained incrementality. The tool features built-in support for major libraries like Django and Pydantic, advanced type inference, and tight integration with uv for script management. OpenAI reports a median 24x speedup and 73 percent reduction in memory after migrating its core Python codebase to Ty. The community response highlights rapid adoption alongside active debates over framework typing support and competition with Pyrefly and Pyright.

key points

  1. OpenAI migrated its core codebase to Ty, achieving a median 24x speedup and 73% reduction in peak memory usage.
  2. Ty 1.0 introduces built-in support for major third-party libraries including Django, Pydantic, pytest, and attrs without requiring external stubs.
  3. Features fine-grained incrementality optimized for live editor updates, outperforming competitors like Pyrefly and Zuban in most benchmarks.
  4. Provides built-in uv integration for dependency management in standalone PEP 723 scripts and automatic fix capabilities via ty check --fix.

who should read it

Python developers and tech leads evaluating high-performance type checkers and language servers.

discussion warm

consensus

Commenters are generally impressed by Ty's speed and active development by the Astral team, though some note that framework support is still maturing compared to established alternatives like Pyright and Mypy.

pushback

Some users express frustration that Python typing overall remains cumbersome, or question whether type checkers should need hardcoded native support for complex frameworks like Django.

best comment by kccqzy ↗

I’ve given up on typing in Python in the work codebase. My colleagues don’t care about types, use meta programming too much (too many type-changing decorators and meta classes, etc), and I’ve seen as much as 2000 false positives per 10k loc.

But even then, when I switched from pyright to ty, I was really amazed at how fast operations like go-to-definition can be. With pyright, the language-server-based go-to-definition is often slower than ripgrep search.

Highlights real-world editor performance gains over Pyright even in heavily metaprogrammed codebases where strict typing is difficult.

Generated by an LLM from the article and thread. Check the sources before relying on it.