saneyaml
Read and write readable YAML safely preserving order and avoiding bad surprises with unwanted infered type conversions. This library is a PyYaml wrapper with sane behaviour to read and write readable YAML safely, typically when used for configuration.
Decision gist · record as of 2026-08-14
Yes, if you need predictable YAML handling for configuration files and want to avoid PyYAML's automatic type conversions. The single dependency, permissive license, and low install friction make it a lightweight addition. Maintenance is aging (last release 2024-08-14, no updates in over 730 days), but the repository is active and there are no known security vulnerabilities. Suitable for stable, non-evolving use cases; monitor the repo if you need ongoing feature development.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PyYAML 5.x or higher and Python 3.7+.
- Low install friction with a single runtime dependency (PyYAML).
- Maintenance status is aging—last commit was 2025-03-30 and the latest release was 2024-08-14, over 730 days ago—but the repository remains active and unarchived.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), so you can use it freely in commercial and private projects without copyleft obligations.
last release 2024-08-14 (730 days) · last repo commit 2025-03-30 · 10 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 170,427 downloads/mo, #10,395 on PyPI
Alternatives
Verify before relying
pip install saneyaml
from saneyaml import load, dump
yaml_text = '''version: 3.0.0
description: Example config'''
data = load(yaml_text)
output = dump(data)
print(output)- Whether duplicate key detection is enabled by default or requires explicit configuration.
- Performance characteristics when handling large YAML files compared to raw PyYAML.
- Scope of 'sane behavior' differences from PyYAML beyond type conversion and ordering.
What it is and what it does
saneyaml is a thin wrapper around PyYAML designed to make YAML parsing and generation more predictable for typical configuration-file use cases. It addresses two common pain points: unwanted type inference (converting strings like '3.0.0' into floats or booleans) and loss of key order. By default, saneyaml loads everything except booleans as strings, preserves insertion order in dictionaries, and can optionally detect duplicate map keys—all while producing clean, readable YAML output when dumping.
The library is intended for developers who need reliable, unsurprising YAML handling in configuration workflows. It trades some of PyYAML's automatic type conversion for predictability, making it especially useful when you want version strings, IDs, and other numeric-looking values to remain strings unless explicitly converted.
Use it for
- Parse configuration files where numeric-looking strings (versions, IDs) must stay strings and not convert to numbers.
- Generate human-readable YAML output from Python dicts while maintaining consistent formatting and key order.
- Detect and report duplicate keys in YAML maps to catch configuration errors early.
- Load YAML safely in build or deployment tools where type surprises could cause silent failures.
- Preserve the order of configuration keys when round-tripping YAML through Python.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need predictable YAML handling for configuration files and want to avoid PyYAML's automatic type conversions.
The single dependency, permissive license, and low install friction make it a lightweight addition. Maintenance is aging (last release 2024-08-14, no updates in over 730 days), but the repository is active and there are no known security vulnerabilities. Suitable for stable, non-evolving use cases; monitor the repo if you need ongoing feature development.
Install
saneyaml on PyPI
Before you install
Low install friction with a single runtime dependency (PyYAML). Maintenance status is aging—last commit was 2025-03-30 and the latest release was 2024-08-14, over 730 days ago—but the repository remains active and unarchived.
Requires PyYAML 5.x or higher and Python 3.7+.
License in practice
Licensed under Apache-2.0 (permissive), so you can use it freely in commercial and private projects without copyleft obligations.
Quickstart
pip install saneyaml
from saneyaml import load, dump
yaml_text = '''version: 3.0.0
description: Example config'''
data = load(yaml_text)
output = dump(data)
print(output)
Verify before relying
- Whether duplicate key detection is enabled by default or requires explicit configuration.
- Performance characteristics when handling large YAML files compared to raw PyYAML.
- Scope of 'sane behavior' differences from PyYAML beyond type conversion and ordering.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagePyYAML |
| Maintenance | Aging 730 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 170,427 / month, #10,395 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software DevelopmentTopic :: Utilities |
Evidence: saneyaml-0.6.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pyyaml wrapper”
- saneyamlA lightweight PyYAML wrapper that reads and writes YAML safely with…
- pyamlProduces human-readable, diff-friendly YAML output from Python data…
- yamlableConverts Python objects to YAML and back using PyYaml as its…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also oyaml · pyaml · yamlcore · yamlable · yamlloader · aspy.yaml · yamlordereddictloader · PyYAML · HyperPyYAML · annotatedyaml