pyproject-fmt-pants-plugin
A Pantsbuild plugin for formatting pyproject.toml files with
pyproject-fmt.
Installation
Add the plugin to pants.toml:
[GLOBAL]
plugins = ["pyproject-fmt-pants-plugin==<version>"]
Then run pyproject-fmt through the fmt and lint goals:
pants fmt :: # rewrite every pyproject.toml in place
pants lint :: # fail when a pyproject.toml is not formatted
How it works
pyproject-fmt is installed into its own Pants resolve from the bundled lockfile, independent of your
project's resolves. The plugin registers one fmt integration, which Pants also runs in check-only mode for
lint.
For each run Pants:
- Selects the
pyproject.tomlfiles among the goal's inputs. - Includes the shared config file, if any (see below).
- Runs
pyproject-fmtonce per file.pyproject-fmtstops after the first file it changes, so one process per file keeps every file in the batch formatted.
Configuration
pyproject-fmt layers its settings in this order, later entries winning:
[pyproject-fmt].args, passed on the command line.- A shared
pyproject-fmt.tomlfile. Pants includes the one in the build root automatically; point[pyproject-fmt].configat a file elsewhere instead. - The
[tool.pyproject-fmt]table of eachpyproject.tomlfile, whichpyproject-fmtreads itself.
So a pyproject-fmt.toml file is optional: repo-wide settings can live in pants.toml alone.
[pyproject-fmt]
# https://pyproject-fmt.readthedocs.io/en/latest/configuration.html#command-line-interface
args = ["--column-width=120", "--indent=2", "--keep-full-version"]
| Option | Default | Purpose |
|---|---|---|
[pyproject-fmt].skip |
false |
Skip pyproject-fmt during pants fmt and pants lint. |
[pyproject-fmt].args |
[] |
Arguments always passed to pyproject-fmt, e.g. --column-width=120. |
[pyproject-fmt].config |
unset | Path to a pyproject-fmt.toml file. Disables discovery. |
[pyproject-fmt].config_discovery |
true |
Pick up a pyproject-fmt.toml file from the build root. |
[pyproject-fmt].install_from_resolve |
unset | Install pyproject-fmt from one of your own resolves instead of the lockfile. |
[pyproject-fmt].interpreter_constraints |
["CPython>=3.14,<3.15"] |
Interpreter that runs pyproject-fmt; independent of your project's constraints. |
--config accepts only a standalone pyproject-fmt.toml: a pyproject.toml fails on its [project] table.
Supported versions
| Plugin | Pants | Python |
|---|---|---|
0.x |
2.33 |
3.14 |
Pants loads plugins into its own interpreter, so the plugin requires the Python version Pants runs on.
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 pyproject-fmt-pants-plugin 0.4.2
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 | Reset |
|---|---|---|---|---|
| pyproject_fmt_pants_plugin-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / pyproject_fmt_pants_plugin-0.4.2-py3-none-any.whl
| Download URL | pyproject_fmt_pants_plugin-0.4.2-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
266c001665fb4a4a0754b84fa4beb64b39f9dc55e44540247416d623e8f76707
|
|
BLAKE2b-256 checksum How to use checksums |
5aab1e2f6bf2249866a8e276d0e1cb4050179e91116839f6a0a97de98eba814b
|
| 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 16, 2026.
Transparency log