pyyml
Use python in yaml
What it is and what it does
pyyml extends YAML parsing to allow Python code execution within YAML files. When you load a YAML file through pyyml, any expression wrapped in ${...} is evaluated as Python code and replaced with its result. You can also import packages at the top of your YAML file using a special # libs:[...] comment syntax, making those modules available to your expressions.
This is useful for configuration files that need computed values—file paths, sums, environment-dependent settings—without leaving YAML syntax. However, the package has received no maintenance since its initial release in April 2019 and depends on pyyaml, which has evolved significantly. The security model of executing arbitrary Python in YAML requires careful vetting of configuration sources.
Use it for:
- Generate computed configuration values (e.g., derived paths, sums) directly in YAML without post-processing
- Build environment-aware configs that reference os or other standard library modules within YAML
- Reduce boilerplate by embedding simple Python logic in configuration files instead of wrapper scripts
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Embeds Python expressions directly in YAML files, evaluating them at parse time to generate dynamic configuration values.
No. The package is abandoned with no updates since April 2019, and its security model—executing Python code embedded in YAML—poses risks if configuration sources are untrusted. Modern alternatives or explicit post-processing of YAML are safer. Only consider it for legacy systems already using it.
Install
pyyml on PyPI
pip
pip install pyymluv
uv add pyymlpoetry
poetry add pyymlInstalling pyyml
Before you install
Low install friction with a single dependency (pyyaml), but the package has been abandoned since its initial release in April 2019 with no updates or maintenance.
License in practice
MIT license permits commercial and private use with minimal restrictions, though the abandoned status means no ongoing legal or security review.
Quickstart
from pyyml import load
with open('conf.yml') as f:
config = load(f.read())
# YAML file with: sum: ${1 + 1}
# Results in: {'sum': 2}
Requires pyyaml as a runtime dependency; YAML files must use ${...} syntax for Python expressions and optional # libs:[...] header for imports.
Verify before relying
- Whether the package works reliably with current Python versions, given its age and lack of maintenance
- Security implications of executing arbitrary Python code embedded in YAML files during parsing
- Compatibility with modern pyyaml versions and whether breaking changes have occurred
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyyaml |
| Maintenance | abandoned — 2,684 days since the last release |
| First released | |
| Downloads | 432,712/month — #6,706 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyyml-0.0.2-py2.py3-none-any.whl
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
yteYTE is a YAML template engine that embeds…
permissive · top 15,000 on PyPI
HiYaPyCoLoads and merges multiple YAML configuration…
copyleft · top 15,000 on PyPI
anyconfigLoads, dumps, and merges configuration files in…
permissive · top 15,000 on PyPI
pyyaml-includeExtends PyYAML to include other YAML files into…
copyleft · top 5,000 on PyPI
empyEmPy is a templating system that embeds Python…
permissive · top 15,000 on PyPI
dynamic-yamlAdds dynamic string interpolation to YAML…
permissive · top 15,000 on PyPI
HyperPyYAMLExtends YAML syntax with Python-friendly…
permissive · top 5,000 on PyPI
ruamel.yaml.jinja2Enables Jinja2 templating within YAML files by…
permissive · top 5,000 on PyPI
envyamlParses YAML configuration files with…
permissive · top 5,000 on PyPI
tfparsetfparse parses and evaluates Terraform HCL…
permissive · top 15,000 on PyPI