skillfed

ruamel.yaml.string

add dump_to_string/dumps method that returns YAML document as string

ruamel-yaml-string v0.1.1 415.6K downloads/30d#6,825 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

ruamel.yaml.string is a plugin for ruamel.yaml that extends the YAML instance with a `dump_to_string` method (aliased as `dumps`). Instead of writing YAML output to a file or stream, it returns the serialized document as a plain Python string. This is useful when you need YAML serialization in memory rather than direct I/O—for example, when building YAML strings for APIs or configuration generation. The method returns the string without a final newline by default, though an `add_final_eol` parameter can control this behavior. The plugin requires ruamel.yaml as a dependency and supports Python 3 and above.

The package is minimal in scope: it adds one core capability to an existing library rather than providing a standalone tool. It has no external runtime dependencies beyond ruamel.yaml and installs as a pure Python wheel. However, it has been abandoned for over 1200 days with no maintenance activity, so compatibility with recent versions of ruamel.yaml is uncertain.

Use it for:

  • Generate YAML strings programmatically for APIs or configuration files without writing to disk
  • Serialize Python data structures to YAML format for embedding in log messages
  • Build YAML documents in memory for dynamic configuration generation
  • Convert Python dictionaries to YAML strings for storage in databases or message queues

Worth the install?

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

Adds a `dump_to_string` method to ruamel.yaml.YAML instances that serializes YAML data to a Python string instead of writing to a file or stream.

Yes, if you are already using ruamel.yaml and need to serialize to strings rather than files. The MIT license is unrestricted, install friction is low, and there are no known vulnerabilities. However, the abandoned status (1200+ days without maintenance) means you should verify compatibility with your version of ruamel.yaml before relying on it in production.

Install

ruamel-yaml-string on PyPI

pip

pip install ruamel-yaml-string

uv

uv add ruamel-yaml-string

poetry

poetry add ruamel-yaml-string

Installing ruamel.yaml.string

Before you install

Low install friction with no runtime dependencies. However, the package is marked abandoned with no releases for over 1200 days, indicating no active maintenance.

License in practice

MIT license is permissive and poses no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install ruamel.yaml.string

import ruamel.yaml

yaml = ruamel.yaml.YAML(typ=['rt', 'string'])
data = dict(abc=42, help=['on', 'its', 'way'])
result = yaml.dump_to_string(data)

Requires ruamel.yaml to be installed; Python >= 3 required

Verify before relying

  • Current compatibility with recent versions of ruamel.yaml given the 1200+ day gap since last release
  • Whether the plugin continues to function correctly with modern ruamel.yaml releases

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 1,200 days since the last release
First released
Downloads 415,572/month — #6,825 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ruamel.yaml.string-0.1.1-py3-none-any.whl

Keywords: yaml, 1.2, dump, python, string

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python

Tags

yaml to string conversionserialize yaml to stringruamel.yaml string outputdump yaml as stringyaml dumps methodin-memory yaml serialization
yaml-serializationruamel-yaml-plugin

More Markup packages