skillfed

pyproject-fmt

Format your pyproject.toml file

pyproject-fmt v2.27.1 908.4K downloads/30d#4,752 on PyPI85
Permissive license Active released

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-fmt

uv

uv add pyproject-fmt

poetry

poetry add pyproject-fmt

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Free Threading :: 1 - Unstable

Tags

pyproject.toml formatterformat python project configconsistent pyproject formattingtoml file formatterpython project metadata formatterpyproject style consistencyautomated toml formatting
formatterpyproject-tomlbuild-tool

More Build Tools packages