# ty
Extremely fast Python type checker and language server from [Astral](https://astral.sh). 10–60x faster than mypy and Pyright.
## Install
```bash
uv tool install ty
# or
brew install ty
```
## Commands
```bash
ty check . # type-check current directory
ty check src tests # check specific directories
ty check file.py # check a single file
ty check --watch # re-check on file changes
ty server # start LSP language server
```
## Key Flags
| Flag | Purpose |
|------|---------|
| `--python-version 3.12` | Target Python version |
| `--python-platform linux` | Target platform |
| `--venv .venv` | Use specific virtual environment |
| `--error RULE` | Treat rule as error |
| `--warn RULE` | Treat rule as warning |
| `--ignore RULE` | Disable a rule |
| `--output-format concise` | Output: `full`, `concise`, `github`, `gitlab`, `junit` |
| `--exit-zero` | Always return exit code 0 |
| `--error-on-warning` | Warnings cause non-zero exit |
## Configuration
Uses `ty.toml` or `[tool.ty]` in `pyproject.toml`:
```toml
[tool.ty]
python-version = "3.12"
[tool.ty.rules]
# override rule severities
possibly-unbound-attribute = "warn"
```
CLI override:
```bash
ty check --config "python-version='3.12'" .
```
---
See also: [[Ruff]], [[uv]]