ty: Astral's New Python Type Checker Released
Astral released ty, a Python type checker written in Rust, today. The company behind uv and Ruff designed ty as an alternative to mypy and Pyright, with performance as a primary focus.
Speed Benchmarks
According to Astral’s benchmarks:
- ty checks the home-assistant project in 2.19 seconds (20x faster than mypy’s 45.66 seconds)
- After editing a file in PyTorch, ty recomputes diagnostics in 4.7ms (80x faster than Pyright’s 386ms)
Key Features
ty includes several design choices that distinguish it from existing type checkers:
- Advanced type narrowing: More sophisticated reachability analysis reduces false positives
- First-class intersection types: Handles complex type relationships
- Detailed diagnostics: Error messages pull context from multiple files, explaining both the problem and potential fixes
- Language server: Full LSP support for Go to Definition, Symbol Rename, Auto-Complete, and other editor features
Installation
Install ty with uv:
uv tool install tyOr use the VS Code extension for editor integration.
Check your project:
ty check .The language server works with any LSP-compatible editor (VS Code, Cursor, Neovim, Emacs).
Current Status
ty is in beta. Astral recommends it for motivated users willing to report issues. The team plans a stable release in 2025, focusing on:
- Stability and bug fixes
- Complete implementation of Python’s typing specification
- First-class support for libraries like Pydantic and Django
Future plans include integration with Ruff and uv for features like dead code elimination and type-aware linting.