skillfed

ruamel.yaml.jinja2

jinja2 pre and post-processor to update with YAML

ruamel-yaml-jinja2 v0.2.7 1.5M downloads/30d#3,858 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

ruamel.yaml.jinja2 is a plugin that bridges Jinja2 templating and YAML by allowing you to embed template logic in YAML files without breaking YAML syntax before rendering. It works by rewriting Jinja2 constructs during loading, rendering the template, and then restoring the original structure during dumping. The key constraint is that you must use the same YAML instance for both loading and dumping to maintain the round-trip integrity.

The intended use case is updating hardcoded values in YAML configuration files while preserving the template logic itself—useful when the template part might only exist in comments or when you want to modify data without touching the templating layer. It integrates with the round-trip processor to maintain formatting and structure.

Use it for:

  • Update hardcoded configuration values in YAML files while preserving embedded Jinja2 template logic.
  • Generate dynamic YAML configurations from templates without breaking YAML validity before rendering.
  • Maintain YAML files with template logic in comments or conditional blocks that should not be modified during updates.
  • Process YAML templates where the template syntax needs to coexist with valid YAML structure.

Worth the install?

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

Enables Jinja2 templating within YAML files by preprocessing templates before YAML parsing and postprocessing after rendering, allowing you to use template logic while keeping the file valid YAML.

No. The package is abandoned (last release 2021-09-23) with no known security vulnerabilities but also no maintenance path forward. If you need Jinja2 templating for YAML, consider rendering templates separately before YAML parsing, or evaluate actively maintained alternatives. Install only if you have an existing codebase already depending on it and cannot migrate.

Install

ruamel-yaml-jinja2 on PyPI

pip

pip install ruamel-yaml-jinja2

uv

uv add ruamel-yaml-jinja2

poetry

poetry add ruamel-yaml-jinja2

Installing ruamel.yaml.jinja2

Before you install

Installation is straightforward with no runtime dependencies. However, the package has been abandoned since 2021-09-23 with no updates since, so expect no bug fixes or maintenance going forward.

License in practice

MIT license is permissive and imposes minimal restrictions—you can use, modify, and distribute the package freely in commercial and private projects with only attribution required.

Quickstart

pip install ruamel.yaml.jinja2

from ruamel.yaml import YAML

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

Requires Python >=3.6. The package integrates with ruamel.yaml's round-trip processor.

Verify before relying

  • Whether ruamel.yaml is automatically installed as a dependency or must be manually installed.
  • Current compatibility with recent Python versions given the last release was 2021-09-23.
  • Whether the package works correctly with modern Jinja2 versions.

Package facts

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

Evidence: ruamel.yaml.jinja2-0.2.7-py2.py3-none-any.whl

Keywords: yaml, 1.2, parser, round-trip, jinja2

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

Tags

jinja2 templates in yamlyaml with template variablespreprocess yaml jinja2yaml template renderingdynamic yaml configurationjinja2 yaml preprocessing
yaml-templatingabandoned

More Markup packages