Skip to content

Repository files navigation

ty-pre-commit

TyimageimageimageActions status

A pre-commit hook for Ty, an extremely fast Python type checker written in Rust.

Distributed as a standalone repository to enable installing Ty via prebuilt wheels from PyPI.

Warning: Ty is currently in preview and not ready for production use. Expect bugs and missing features.

Using Ty with pre-commit

To run Ty's type checker via pre-commit, add the following to your .pre-commit-config.yaml:

repos:
- repo: https://github.com/allganize/ty-pre-commit# Ty version.rev: v0.0.74a35a34a33a32a31a30a29a28a27a26a25a24a23a22a21a20hooks:
# Run the type checker.
- id: ty-check

To run Ty with additional arguments:

repos:
- repo: https://github.com/allganize/ty-pre-commit# Ty version.rev: v0.0.74a35a34a33a32a31a30a29a28a27a26a25a24a23a22a21a20hooks:
# Run the type checker with verbose output.
- id: ty-checkargs: [ --verbose, --output-format=full ]

To run only on specific file types:

repos:
- repo: https://github.com/allganize/ty-pre-commit# Ty version.rev: v0.0.74a35a34a33a32a31a30a29a28a27a26a25a24a23a22a21a20hooks:
# Run the type checker.
- id: ty-checktypes_or: [ python, pyi ]

Ty is a type checker and can be run alongside other tools like Black, isort, and Ruff for formatting and linting. Since Ty only performs type checking, it doesn't conflict with formatters and can be placed anywhere in your pre-commit hook chain.

License

ty-pre-commit is licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ty-pre-commit by you, as defined in the Apache-2.0 license, shall be dually licensed as above, without any additional terms or conditions.

About

No description, website, or topics provided.

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages