yamlfix
A simple opionated yaml formatter that keeps your comments!
What it is and what it does
yamlfix is a YAML formatter designed to reformat YAML files consistently while keeping your comments intact—a feature many formatters lose. It runs as a command-line tool and depends on click for CLI handling, ruyaml for YAML parsing, maison for configuration, and pydantic for validation. The package targets developers working with YAML configuration files who want automated formatting without losing inline documentation.
The project is in production/stable status and supports Python 3.9, 3.10, and 3.11. With over 1 million monthly downloads, it ranks in the top 5000 PyPI packages. The aging maintenance status reflects a 239-day gap since the last release, but the repository remains active and unarchived, indicating the tool is mature and not under active development rather than abandoned.
Use it for:
- Automatically format YAML configuration files in CI/CD pipelines while preserving inline comments.
- Enforce consistent YAML style across a team's infrastructure-as-code or Kubernetes manifests.
- Pre-commit hook to standardize YAML formatting before committing configuration files.
- Batch reformat existing YAML files to a consistent style without losing documentation.
- Integrate into linting workflows alongside other code quality tools for configuration files.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
yamlfix is a command-line YAML formatter that reformats YAML files according to an opinionated style while preserving comments.
Yes, if you need YAML formatting with comment preservation and accept GPLv3 licensing. The low install friction, stable maturity, and high download volume indicate a reliable tool. The aging maintenance is not a blocker for a stable formatter, but verify that the opinionated style matches your team's needs before adopting it widely.
Install
yamlfix on PyPI
pip
pip install yamlfixuv
uv add yamlfixpoetry
poetry add yamlfixInstalling yamlfix
Before you install
Low install friction with four straightforward runtime dependencies. Maintenance status is aging—last release was 239 days ago—but the repository remains active and not archived, suggesting the project is stable rather than abandoned.
License in practice
GPLv3 is a copyleft license; any derivative work or modification must also be licensed under GPLv3. If you are building proprietary software or have license compatibility constraints, this may restrict your use.
Quickstart
pip install yamlfix
import yamlfix
formatted = yamlfix.fix_yaml(yaml_content)
Requires Python 3.9.1 or later.
Verify before relying
- Whether yamlfix can be used as a library API (the snippet assumes it, but the fact sheet emphasizes command-line usage).
- What specific formatting rules the 'opinionated' style enforces and whether they are configurable.
Package facts
| License | GPL-3.0-only (copyleft) |
| Python support | supports the current Python release (>=3.9.1) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — click, ruyaml, maison, pydantic |
| Maintenance | aging — 239 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,129,395/month — #4,320 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: yamlfix-1.19.1-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
config-formatterAutomatically formats .ini and .cfg…
permissive · top 15,000 on PyPI
beautyshBeautysh automatically formats and beautifies…
permissive · top 15,000 on PyPI
yapfYAPF automatically reformats Python code to…
permissive · top 5,000 on PyPI
tox-toml-fmtFormats tox.toml files with consistent style…
permissive · top 15,000 on PyPI
sphinxcontrib-autoyamlA Sphinx extension that auto-generates…
permissive · top 15,000 on PyPI
ruyamlruyaml is a YAML parser and serializer that…
permissive · top 5,000 on PyPI
pyamlProduces human-readable, diff-friendly YAML…
permissive · top 5,000 on PyPI
yamllintyamllint checks YAML files for syntax errors,…
copyleft · top 1,000 on PyPI
saneyamlA lightweight PyYAML wrapper that reads and…
permissive · top 15,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI