ty-pants-plugin
A Pantsbuild plugin for type checking Python code with
ty, the Rust-based type checker from Astral.
Installation
Add the plugin to pants.toml and enable its backend:
[GLOBAL]
plugins = ["ty-pants-plugin==<version>"]
backend_packages.add = ["ty_pants_plugin"]
Then run ty through the check goal:
pants check ::
How it works
ty is downloaded as a static binary; nothing is installed into a Pants resolve. For each run Pants:
- Partitions the requested targets by resolve and interpreter constraints, like the builtin mypy backend.
- Builds a virtual environment from the partition's third-party requirements and passes it to
tywith--python, so third-party imports resolve against the versions in your lockfile. - Passes every Pants source root of the targets' transitive closure with
--extra-search-path, so first-party imports resolve across source roots. - Derives
--python-versionfrom the partition's interpreter constraints, unless[ty].argsor the config file already sets it. - Runs
ty checkon the requested files only. Dependencies are present for import resolution but are not themselves reported on.
Configuration
ty reads ty.toml, or the [tool.ty] table of pyproject.toml, from the directory it runs in and its
ancestors. Pants runs it from the build root, so only a config in the build root takes effect. Pants
includes that file automatically. Point [ty].config at a ty.toml elsewhere to override discovery.
| Option | Default | Purpose |
|---|---|---|
[ty].skip |
false |
Skip ty during pants check. |
[ty].args |
[] |
Extra arguments for ty check, e.g. --output-format concise. |
[ty].config |
unset | Path to a ty.toml. Disables discovery. |
[ty].config_discovery |
true |
Pick up ty.toml or pyproject.toml from the build root. |
[ty].version |
bundled default | ty release to download. |
[ty].known_versions |
bundled default | Checksums of downloadable releases; extend to use another version. |
[ty].interpreter_constraints |
["CPython>=3.10,<3.16"] |
Fallback constraints for the environment, when the code declares none. |
To opt a target out, set skip_ty=True on any python_source, python_sources, python_test,
python_tests or python_test_utils target.
Using a different ty version
Add the release's checksums and sizes to known_versions and set version:
[ty]
version = "0.0.90"
known_versions.add = [
"0.0.90|linux_arm64 |<sha256>|<size>",
"0.0.90|linux_x86_64|<sha256>|<size>",
"0.0.90|macos_arm64 |<sha256>|<size>",
"0.0.90|macos_x86_64|<sha256>|<size>",
]
Compute each line with curl -L $URL | tee >(wc -c) >(shasum -a 256) >/dev/null, where $URL is the
ty-<target>.tar.gz asset of the GitHub release.
Supported versions
| Plugin | Pants | Python | ty |
|---|---|---|---|
0.x |
2.33 |
3.14 |
>=0.0.80,<1 |
Pants loads plugins into its own interpreter, so the plugin requires the Python version Pants runs on. The
code being checked may target any Python version ty supports.
Releases
Wheels are published to PyPI. Release notes live in the changelog and on the GitHub releases page.
Contributing, Bug Reports and Feature Requests
This plugin lives in the pants-plugin-depot repo. See its CONTRIBUTING.md, or open an issue.
Metadata
Release files for ty-pants-plugin 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ty_pants_plugin-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ty_pants_plugin-0.1.1-py3-none-any.whl |
Release files / ty_pants_plugin-0.1.1-py3-none-any.whl
| Download URL | ty_pants_plugin-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61dedca71aebf0035f7107973d2dc2e860f9df6e157d068c525260787135fe03
|
|
BLAKE2b-256 checksum How to use checksums |
a0b2768f0531fec06a6cee339f7f902efc57dd4badcc70838187aa4170014038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logSecurity for ty-pants-plugin 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
1 file in this release has been uploaded with provenance metadata.
Attestation for ty_pants_plugin-0.1.1-py3-none-any.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.