skillfed

pyaml

PyYAML-based module to produce a bit more pretty and readable YAML-serialized data

pyaml v26.7.0 7.6M downloads/30d#1,712 on PyPI138
Permissive license WTFPL Active released

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 pyaml

uv

uv add pyaml

poetry

poetry add pyaml

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: Public DomainProgramming Language :: PythonProgramming Language :: Python :: 3.8Topic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

yaml pretty printhuman readable yaml serializationyaml formatter pythonreadable yaml dumpyaml output beautifierpyyaml wrapperyaml readability tool
yaml-serializationcli-tool

More Software Development packages