Skip to main content

ty-pants-plugin

PyPI Version

A Pantsbuild plugin for type checking Python code with ty, the Rust-based type checker from Astral.

Installation

Add the plugin to pants.toml:

[GLOBAL]
plugins = ["ty-pants-plugin==<version>"]

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:

  1. Partitions the requested targets by resolve and interpreter constraints, like the builtin mypy backend.
  2. Builds a virtual environment from the partition's third-party requirements and passes it to ty with --python, so third-party imports resolve against the versions in your lockfile.
  3. Passes every Pants source root of the targets' transitive closure with --extra-search-path, so first-party imports resolve across source roots.
  4. Derives --python-version from the partition's interpreter constraints, unless [ty].args or the config file already sets it.
  5. Runs ty check on 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.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for ty-pants-plugin 0.1.3
File Interpreter ABI Platform Actions
ty_pants_plugin-0.1.3-py3-none-any.whl Python 3 none any Details for ty_pants_plugin-0.1.3-py3-none-any.whl

Release files / ty_pants_plugin-0.1.3-py3-none-any.whl

Download URL ty_pants_plugin-0.1.3-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca44c30a95d3b706daf33b43d5a147851cfc97e28239f06659425d660b164f81
BLAKE2b-256 checksum
How to use checksums
b60f6b2b3bbd17bd5cf6ceec6f063b9f7dfa94a5a9ee361afb116852c4a797fc
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 17, 2026.

Transparency log

Security for ty-pants-plugin 0.1.3

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.3-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 17, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page