pyproject-fmt
Format your pyproject.toml file
What it is and what it does
pyproject-fmt is a command-line formatter and Python library that applies consistent, opinionated formatting to pyproject.toml files while preserving comments. It follows the philosophy of tools like Black: minimal configuration by design, trading flexibility for predictability and smaller diffs. The tool can be used as a CLI (via pipx or uv), integrated into pre-commit hooks, or called directly from Python code via the run() function.
It offers configuration through a [tool.pyproject-fmt] table in your pyproject.toml or a standalone pyproject-fmt.toml file, with options to control column width, indentation, table formatting style (short/long), spacing between tables, and automatic Python version classifier generation. The formatter normalizes your project metadata layout, handles dependency specifiers, and can expand or collapse nested table structures according to your preferences.
Use it for:
- Enforce consistent pyproject.toml formatting across a team or monorepo using a shared pyproject-fmt.toml configuration file.
- Integrate into pre-commit hooks to automatically format pyproject.toml on every commit.
- Programmatically format pyproject.toml files from within build scripts or CI/CD pipelines using the Python API.
- Auto-generate Python version classifiers based on your requires-python setting to keep metadata up-to-date.
- Standardize table formatting (collapsed dotted keys vs. expanded sections) across multiple projects.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Formats pyproject.toml files with consistent, opinionated style and preserves comments, offering few configuration options by design.
Yes. The package is actively maintained (release 2 days ago), has zero known vulnerabilities, supports modern Python versions (3.10–3.15), and solves a real problem—keeping pyproject.toml formatting consistent with minimal configuration overhead. The permissive MIT license and lack of runtime dependencies make it low-risk. Medium install friction from compiled wheels is standard for modern Python tools and not a blocker.
Install
pyproject-fmt on PyPI
pip
pip install pyproject-fmtuv
uv add pyproject-fmtpoetry
poetry add pyproject-fmtInstalling pyproject-fmt
Before you install
Medium install friction due to compiled wheels across many platforms (cp310-abi3 through cp315-cp315t, multiple OS/architecture combinations), but actively maintained with a release just 2 days ago and no runtime dependencies to resolve.
License in practice
MIT license (permissive) means you can use, modify, and distribute this tool freely with minimal restrictions.
Quickstart
# Install via pipx or uv (recommended)
uv tool install pyproject-fmt
# Or use as a Python module
from pyproject_fmt import run
exit_code = run(["path/to/pyproject.toml"])
Requires Python 3.10 or higher to run.
Verify before relying
- Whether the tool handles all TOML syntax edge cases beyond the documented configuration options.
- Performance characteristics on very large or deeply nested pyproject.toml files.
- Compatibility with non-standard or custom tool sections in pyproject.toml.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 908,448/month — #4,752 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyproject_fmt-2.27.1-cp310-abi3-macosx_10_12_x86_64.whl; pyproject_fmt-2.27.1-cp310-abi3-macosx_11_0_arm64.whl; pyproject_fmt-2.27.1-cp310-abi3-manylinux_2_28_aarch64.whl; pyproject_fmt-2.27.1-cp310-abi3-manylinux_2_28_x86_64.whl; pyproject_fmt-2.27.1-cp310-abi3-manylinux_2_31_riscv64.whl; pyproject_fmt-2.27.1-cp310-abi3-musllinux_1_2_aarch64.whl; pyproject_fmt-2.27.1-cp310-abi3-musllinux_1_2_x86_64.whl; pyproject_fmt-2.27.1-cp310-abi3-win_amd64.whl; pyproject_fmt-2.27.1-cp310-abi3-win_arm64.whl; pyproject_fmt-2.27.1-cp314-cp314t-macosx_10_12_x86_64.whl; pyproject_fmt-2.27.1-cp314-cp314t-macosx_11_0_arm64.whl; pyproject_fmt-2.27.1-cp314-cp314t-manylinux_2_28_aarch64.whl; pyproject_fmt-2.27.1-cp314-cp314t-manylinux_2_28_x86_64.whl; pyproject_fmt-2.27.1-cp314-cp314t-musllinux_1_2_aarch64.whl; pyproject_fmt-2.27.1-cp314-cp314t-musllinux_1_2_x86_64.whl; pyproject_fmt-2.27.1-cp314-cp314t-win_amd64.whl; pyproject_fmt-2.27.1-cp314-cp314t-win_arm64.whl; pyproject_fmt-2.27.1-cp315-cp315t-macosx_10_12_x86_64.whl; pyproject_fmt-2.27.1-cp315-cp315t-macosx_11_0_arm64.whl; pyproject_fmt-2.27.1-cp315-cp315t-manylinux_2_28_aarch64.whl
Keywords: format, pyproject
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
tox-toml-fmtFormats tox.toml files with consistent style…
permissive · top 15,000 on PyPI
toml-fmt-commonProvides shared Python utilities and logic for…
permissive · top 15,000 on PyPI
uv-sortAlphabetically sorts dependencies in uv's…
permissive · top 15,000 on PyPI
tomlrtReads and writes TOML files while preserving…
permissive · top 15,000 on PyPI
toml-sortCommand-line utility and Python library to sort…
permissive · top 15,000 on PyPI
sphinx-pyprojectLoads Sphinx documentation configuration from…
permissive · top 15,000 on PyPI
validate-pyprojectValidates pyproject.toml files against JSON…
copyleft · top 15,000 on PyPI
pyproject-parserParses and extracts metadata from…
permissive · top 15,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
Flake8-pyprojectFlake8-pyproject enables Flake8 to read its…
permissive · top 5,000 on PyPI