Official pre-commit hook for ty type checker.
Add this to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/JacobCoffee/ty-pre-commit
rev: v0.0.1
hooks:
- id: tyThe hook respects your project's pyproject.toml configuration:
[tool.ty]
[tool.ty.environment]
extra-paths = ["src/"]
[tool.ty.src]
exclude = ["tests/**/*.py"]Pass additional arguments:
- id: ty
args: ["check", "--strict"]- Python 3.8+
- ty type checker (installed automatically as dependency)
While this hook works with pre-commit, you might also consider:
- prek - Fast, pure Rust implementation with better performance
- lefthook - Fast Git hooks manager written in Go
Both support the same .pre-commit-config.yaml format and are drop-in replacements with improved speed.
MIT
Jacob Coffee (@JacobCoffee)