pyaml
PyYAML-based module to produce a bit more pretty and readable YAML-serialized data
What it is and what it does
pyaml wraps PyYAML to produce YAML output optimized for human reading and editing rather than round-trip fidelity. It applies sensible formatting defaults—unicode support, 100-character width, sorted dict keys, simplified boolean representation—and makes stylistic choices like rendering null values as empty, using literal block scalars for certificates, and adding vertical spacing between sections. The module is designed for serialization only; the description explicitly warns that output may not deserialize exactly as exported and is not guaranteed stable between versions, though representation tweaks can usually be disabled via parameters.
It's a small, single-dependency package intended for cases where human-readable YAML output matters more than perfect round-tripping. The author recommends copy-pasting its functionality into projects that only need part of it, rather than adding a dependency for its own sake.
Use it for:
- Pretty-print configuration files or complex data structures to stdout or files for inspection and manual editing.
- Generate human-friendly YAML diffs by sorting keys and controlling formatting to reduce noise in version control.
- Debug-print non-trivial Python objects (dicts, dataclasses, enums) as readable YAML during development.
- Convert JSON or YAML files to more readable YAML format via the command-line interface.
- Format logging or diagnostic output as readable YAML for operational visibility.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Produces human-readable, diff-friendly YAML output from Python data structures using PyYAML as its foundation, with sensible defaults for formatting and readability.
Yes, if you need human-readable YAML output and can accept that it prioritizes readability over round-trip fidelity. Low install friction, active maintenance, no known vulnerabilities, and permissive licensing make it a safe choice. Skip it if you require exact deserialization or prefer to use PyYAML directly with explicit parameters.
Install
pyaml on PyPI
pip
pip install pyamluv
uv add pyamlpoetry
poetry add pyamlInstalling pyaml
Before you install
Low friction: single runtime dependency (PyYAML), pure Python wheel, actively maintained with a release 41 days ago.
License in practice
Licensed under WTFPL (permissive), which places no significant restrictions on use or redistribution.
Quickstart
pip install pyaml
import pyaml
data = {'key': 'value', 'nested': {'a': 1, 'b': 2}}
pyaml.p(data)
Requires Python 3.8 or later.
Verify before relying
- Whether output stability guarantees exist across versions (description notes tweaks may change representation).
- Whether the module handles all PyYAML-compatible types or has undocumented limitations.
Package facts
| License | WTFPL (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — PyYAML |
| Maintenance | actively maintained — 41 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,624,214/month — #1,712 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyaml-26.7.0-py3-none-any.whl
Keywords: yaml, serialization, pretty-print, formatter, human, readability
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
yamlableConverts Python objects to YAML and back using…
permissive · top 15,000 on PyPI
saneyamlA lightweight PyYAML wrapper that reads and…
permissive · top 15,000 on PyPI
dmiparserParses dmidecode output into structured Python…
permissive · top 15,000 on PyPI
oyamloyaml is a drop-in replacement for PyYAML that…
permissive · top 5,000 on PyPI
ruamel.yaml.stringAdds a `dump_to_string` method to…
permissive · top 15,000 on PyPI
PyYAML-ftPyYAML-ft is a YAML parser and emitter for…
permissive · top 5,000 on PyPI
HyperPyYAMLExtends YAML syntax with Python-friendly…
permissive · top 5,000 on PyPI
dynamic-yamlAdds dynamic string interpolation to YAML…
permissive · top 15,000 on PyPI
ruamel.yamlLoads and dumps YAML 1.2 with round-trip…
permissive · top 1,000 on PyPI