skillfed

ruyaml

ruyaml is a fork of ruamel.yaml

ruyaml v0.91.0 1.5M downloads/30d#3,838 on PyPI79
Permissive license MIT license Active released

What it is and what it does

ruyaml is a maintained fork of ruamel.yaml that parses and serializes YAML while preserving comments, blank lines, and formatting during round-trip operations. It's designed to solve the problem of YAML libraries that lose structural metadata when loading and re-saving files—critical for configuration management, templating, and any workflow where human-readable YAML structure matters.

The package provides a YAML() class-based API (replacing deprecated top-level functions) and depends only on distro and setuptools. It supports Python 3.6 through 3.10 and is actively maintained by the pycontribs community to ensure long-term stability. The fork was created to secure the library's future by distributing maintenance responsibilities.

Use it for:

  • Editing and updating configuration files while preserving comments and formatting for human readability
  • Building YAML-based templating or code generation systems that need to maintain structural integrity
  • Loading YAML data with comments and re-serializing it without losing metadata for documentation or audit trails
  • Configuration management tools that must preserve user comments and formatting across updates
  • Parsing structured YAML documents where comment preservation is required for compliance or clarity

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

ruyaml is a YAML parser and serializer that preserves comments, formatting, and structure during round-trip load/dump cycles, designed as a maintained fork of ruamel.yaml.

Yes, with conditions. ruyaml is production-stable (MIT license, actively maintained repository, no known vulnerabilities, low install friction) and solves a real problem that standard YAML libraries don't—preserving comments and formatting. However, the last PyPI release was December 2021 despite recent repository commits; verify that the version available on PyPI meets your needs, or consider pinning to a specific version if you depend on recent fixes.

Install

ruyaml on PyPI

pip

pip install ruyaml

uv

uv add ruyaml

poetry

poetry add ruyaml

Installing ruyaml

Before you install

Low install friction with only two runtime dependencies (distro and setuptools). The package is actively maintained with recent commits and a stable release history, though the last PyPI release was in December 2021 despite ongoing repository activity.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely in both open-source and proprietary projects with minimal restrictions.

Quickstart

pip install ruyaml

import ruyaml as yaml

yaml_obj = yaml.YAML()
data = yaml_obj.load(open('config.yaml'))
yaml_obj.dump(data, open('output.yaml', 'w'))

Requires Python 3.6 or later; the old top-level functions (load, dump, safe_load, etc.) are deprecated—use YAML() instance methods instead.

Verify before relying

  • Current maintenance status relative to the original ruamel.yaml—whether ruyaml is actively receiving feature parity updates
  • Specific performance characteristics compared to ruamel.yaml or PyYAML for large YAML files
  • Whether the package is suitable for production use given the last PyPI release was December 2021

Package facts

License MIT license (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 2 — distro, setuptools
Maintenance actively maintained — 1,711 days since the last release
Last repo commit
First released
Downloads 1,495,051/month — #3,838 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ruyaml-0.91.0-py3-none-any.whl

Keywords: selinux, virtualenv

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Utilities

Tags

yaml parser with commentsround-trip yaml serializationpreserve yaml formattingyaml with comment preservationruamel.yaml forkstructured yaml processingyaml configuration parsing
yaml-parsingcomment-preservationconfiguration-management

More Utilities packages