ty: Extremely Fast Python Type Checker
ty is an extremely fast Python type checker and language server, written in Rust. It aims to provide comprehensive diagnostics and real-time editor integration, offering significantly faster performance compared to other Python type checkers. Currently in beta/preview, it is under active and rapid development with frequent releases, typically multiple times a week.
Warnings
- breaking ty is currently in 0.0.x versioning, meaning its API is not yet stable. Breaking changes, including changes to diagnostics and configuration formats, may occur between any two versions. Users should review release notes for each update.
- gotcha As a preview release, ty is not yet recommended for production use. It may have missing features, known issues, or unexpected behavior in certain complex scenarios. It's best suited for experimentation, personal projects, or integrating into development workflows for fast feedback.
- gotcha When both `ty.toml` and `pyproject.toml` files are present in the same directory, `ty.toml` takes precedence for configuration settings, and the `[tool.ty]` section in `pyproject.toml` will be ignored.
- gotcha Correct environment discovery is crucial for ty to find installed packages and resolve imports. If ty cannot find an active virtual environment or a `.venv` directory, it may fall back to system Python, leading to `unresolved-import` diagnostics for project dependencies.
- breaking From version `0.0.25`, ty introduced support for `type:ignore[ty:code]` suppressions, aligning with `ruff`'s suppression mechanism. Older, general `# type: ignore` comments might behave differently or be less granular.
Install
-
pip install ty -
uv tool install ty -
uvx ty check
Imports
- ty
ty check my_file.py
Quickstart
import typing
def greet(name: str) -> str:
return "Hello, " + name
# Intentional type error for demonstration
result: int = greet("World")