Skip to content
Edit this page View source of this page

ty

ty checks Python types. It can report that an argument has the wrong type, that a value may be None where a real value is required, or that an import cannot be resolved. It complements Ruff and your project's tests.

Configuration in this template

ty.toml sets src.respect-ignore-files = true, so discovery follows ignore files such as .gitignore. The template declares ty in mise.toml and registers a ty hook in prek.toml. Add Python source in your derived repository to get meaningful results from the check.

Check types

From the root of an initialized Python project, sync its dependencies and run ty. A current environment helps ty find dependencies your code imports.

uv sync
ty check

When working on one area, pass a source path such as ty check src if that directory exists in your layout. To change discovery or the severity of a diagnostic, edit ty.toml and run the check again. ty type-checking guide