tox-toml-fmt
Format your pyproject.toml file
What it is and what it does
tox-toml-fmt is a command-line tool and Python library that reformats tox.toml files according to a fixed set of opinionated rules, similar to how black formats Python code. It normalizes string quotes, key formatting, array layout, and table structure while preserving comments. The tool supports minimal configuration (column width, indentation, pinned environments) and can be used standalone, integrated as a pre-commit hook, or called programmatically from Python code.
The formatter runs on Python 3.10 and higher and is distributed as compiled wheels for multiple platforms. It depends on toml-fmt-common for shared formatting logic. Recent updates include support for free-threaded Python wheels and fixes for empty table handling.
Use it for:
- Enforce consistent formatting across tox.toml files in a monorepo or team project
- Integrate as a pre-commit hook to automatically format tox.toml on every commit
- Programmatically format tox.toml files in build or CI/CD automation scripts
- Standardize tox configuration style without manual configuration of dozens of formatting rules
- Reduce diff noise in code reviews by applying deterministic formatting rules
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Formats tox.toml files with consistent style and comment preservation, applying opinionated rules similar to black for Python code.
Yes, if you manage tox.toml files and want consistent formatting with minimal configuration overhead. The tool is actively maintained, has no known vulnerabilities, and uses a permissive license. Install via pipx or uv to avoid dependency conflicts. Not necessary if you have no tox.toml files or prefer manual formatting.
Install
tox-toml-fmt on PyPI
pip
pip install tox-toml-fmtuv
uv add tox-toml-fmtpoetry
poetry add tox-toml-fmtInstalling tox-toml-fmt
Before you install
Medium install friction due to compiled wheels across multiple platforms and Python versions (3.10+). Active maintenance with recent releases; last commit 2026-08-12 and 85 repository stars indicate ongoing support.
License in practice
MIT license (permissive) allows use in most projects without restriction.
Quickstart
# Install via pipx (recommended)
pipx install tox-toml-fmt
# Or as a Python module
from tox_toml_fmt import run
exit_code = run(["path/to/tox.toml"])
Requires Python 3.10 or higher; recommended installation via pipx or uv to avoid system-wide dependency conflicts.
Verify before relying
- Exact behavior differences between CLI, pre-commit hook, and programmatic Python API usage
- Performance characteristics on large or deeply nested tox.toml files
- Compatibility with non-standard TOML extensions or vendor-specific tox configurations
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — toml-fmt-common |
| Maintenance | actively maintained — 101 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 242,800/month — #8,838 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tox_toml_fmt-1.9.3-cp310-abi3-macosx_10_12_x86_64.whl; tox_toml_fmt-1.9.3-cp310-abi3-macosx_11_0_arm64.whl; tox_toml_fmt-1.9.3-cp310-abi3-manylinux_2_28_aarch64.whl; tox_toml_fmt-1.9.3-cp310-abi3-manylinux_2_28_x86_64.whl; tox_toml_fmt-1.9.3-cp310-abi3-manylinux_2_31_riscv64.whl; tox_toml_fmt-1.9.3-cp310-abi3-musllinux_1_2_x86_64.whl; tox_toml_fmt-1.9.3-cp310-abi3-win_amd64.whl; tox_toml_fmt-1.9.3-cp313-cp313t-macosx_10_12_x86_64.whl; tox_toml_fmt-1.9.3-cp313-cp313t-macosx_11_0_arm64.whl; tox_toml_fmt-1.9.3-cp313-cp313t-manylinux_2_28_aarch64.whl; tox_toml_fmt-1.9.3-cp313-cp313t-manylinux_2_28_x86_64.whl; tox_toml_fmt-1.9.3-cp313-cp313t-musllinux_1_2_x86_64.whl; tox_toml_fmt-1.9.3-cp313-cp313t-win_amd64.whl; tox_toml_fmt-1.9.3-cp314-cp314t-macosx_10_12_x86_64.whl; tox_toml_fmt-1.9.3-cp314-cp314t-macosx_11_0_arm64.whl; tox_toml_fmt-1.9.3-cp314-cp314t-manylinux_2_28_aarch64.whl; tox_toml_fmt-1.9.3-cp314-cp314t-manylinux_2_28_x86_64.whl; tox_toml_fmt-1.9.3-cp314-cp314t-musllinux_1_2_x86_64.whl; tox_toml_fmt-1.9.3-cp314-cp314t-win_amd64.whl; tox_toml_fmt-1.9.3-cp315-cp315t-macosx_10_12_x86_64.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
pyproject-fmtFormats pyproject.toml files with consistent,…
permissive · top 5,000 on PyPI
toml-fmt-commonProvides shared Python utilities and logic for…
permissive · top 15,000 on PyPI
toml-sortCommand-line utility and Python library to sort…
permissive · top 15,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
yamlfixyamlfix is a command-line YAML formatter that…
copyleft · top 5,000 on PyPI
tomlrtReads and writes TOML files while preserving…
permissive · top 15,000 on PyPI
tombiTombi is a TOML formatter, linter, and language…
permissive · top 15,000 on PyPI
tomli-wTomli-W serializes Python dictionaries to TOML…
permissive · top 1,000 on PyPI
perkyPerky parses a minimal, human-friendly text…
permissive · top 15,000 on PyPI
mdformat-blackA plugin for mdformat that automatically…
permissive · top 15,000 on PyPI