A Pants check backend for the Astral ty Python type checker.
Reason this release was yanked:
doesn't install properly
Project description
pants-ty-plugin
pants-ty-plugin adds a Pants check backend for Astral ty.
It is designed for Pants 2.31.x and currently supports Linux and macOS. The backend installs
ty as an external binary, then runs it with:
- a resolve-backed Python environment for third-party dependencies
- Pants source roots as
--extra-search-pathentries for first-party imports
That means ty can resolve imports that Pants already knows about.
Features
pants check --only=ty ...skip_ty = trueon Python targetsty.tomldiscovery[tool.ty]discovery frompyproject.toml- resolve-aware
--python - source-root-aware
--extra-search-path
Install
Option 1: vendor the plugin into a private repo
Copy only the Python package files from pants-plugins/pants_ty/ into your repo's
pants-plugins/pants_ty/ directory:
__init__.pyregister.pyrules.pyskip_field.pysubsystem.py
Do not copy this plugin repo's development-only files:
pants-plugins/BUILDpants-plugins/pants_ty/BUILDpants-plugins/lock.txttests/- this repo's
pants.toml,pyproject.toml, or GitHub workflow files
Those files are only for developing and releasing pants-ty-plugin itself. A consuming repo
should use its own resolves, lockfiles, and test setup.
Then configure:
[GLOBAL]
pants_version = "2.31.0"
backend_packages = [
"pants.backend.python",
"pants_ty",
]
pythonpath = ["%(buildroot)s/pants-plugins"]
If you accidentally copy the dev BUILD files too, you may see an error like:
UnrecognizedResolveNamesError: ... resolve ... pants-plugins
That means your consuming repo picked up this repo's internal development resolve. Remove the
copied BUILD files and keep only the plugin Python modules.
Option 2: install as a published plugin
Once the package is published, use:
[GLOBAL]
plugins = ["pants-ty==0.1.0"]
backend_packages = [
"pants.backend.python",
"pants_ty",
]
Configure
Create either ty.toml or add [tool.ty] to pyproject.toml.
Example:
[tool.ty]
exclude = [".pants.d", "dist"]
Pants exposes the plugin options under [ty]:
[ty]
args = ["--output-format=concise"]
config_discovery = true
Useful commands:
pants help ty
pants check --only=ty ::
pants check --only=ty path/to/pkg::
To skip a target:
python_sources(
name="lib",
skip_ty=True,
)
Development
This repo uses Pants to lint, test, and dogfood the plugin itself.
ruff check pants-plugins tests
pants test ::
pants check ::
To build a distributable wheel and sdist:
python -m build
Repository layout
pants-plugins/pants_ty: plugin sourcetests/pants_ty: unit and integration testspants.toml: local development configpants.ci.toml: CI-specific Pants settings
Notes
- The Pants plugin API is not stable across minor versions. This repo currently targets
Pants
2.31.x. - The backend only resolves imports that Pants already knows through source roots and target resolves.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pants_ty-0.1.0.tar.gz.
File metadata
- Download URL: pants_ty-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99cc802db1a02ab1790c7133848fa80ba0229c719fdf511d6e76fdfc24427ba8
|
|
| MD5 |
12e6dc07bd9530d0c463d29fa7d06bd8
|
|
| BLAKE2b-256 |
656d8fd6036d769d8ee1f4be079929cd7f68d3ef6e414caec1f7863b09bbff09
|
Provenance
The following attestation bundles were made for pants_ty-0.1.0.tar.gz:
Publisher:
release.yml on vrazdalovschi/pants-ty-plugin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pants_ty-0.1.0.tar.gz -
Subject digest:
99cc802db1a02ab1790c7133848fa80ba0229c719fdf511d6e76fdfc24427ba8 - Sigstore transparency entry: 1154686532
- Sigstore integration time:
-
Permalink:
vrazdalovschi/pants-ty-plugin@c20d967da1ab86e92a3e8f11360c55e9391c153f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vrazdalovschi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c20d967da1ab86e92a3e8f11360c55e9391c153f -
Trigger Event:
push
-
Statement type:
File details
Details for the file pants_ty-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pants_ty-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20330c55ff3c62a090507eb554e0e6fcf801c2d1c97834709040c2d4da9376b1
|
|
| MD5 |
306f387413e49fd76dcb56769f142e6b
|
|
| BLAKE2b-256 |
90c226e8822d45c6b191f762581e70f8e14493d80056be92bfd5248f4f5d016b
|
Provenance
The following attestation bundles were made for pants_ty-0.1.0-py3-none-any.whl:
Publisher:
release.yml on vrazdalovschi/pants-ty-plugin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pants_ty-0.1.0-py3-none-any.whl -
Subject digest:
20330c55ff3c62a090507eb554e0e6fcf801c2d1c97834709040c2d4da9376b1 - Sigstore transparency entry: 1154686561
- Sigstore integration time:
-
Permalink:
vrazdalovschi/pants-ty-plugin@c20d967da1ab86e92a3e8f11360c55e9391c153f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vrazdalovschi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c20d967da1ab86e92a3e8f11360c55e9391c153f -
Trigger Event:
push
-
Statement type: