dynamic-yaml
Enables self referential yaml entries
What it is and what it does
Dynamic YAML extends PyYAML to support self-referential configuration values. Instead of repeating paths or values throughout a YAML file, you can use Python format string syntax (curly braces) to reference other keys in the configuration tree—for example, `{dirs.home}/venvs/{project_name}` will resolve to the actual values of those keys. This turns static YAML into a lightweight templating system suitable for managing complex configuration hierarchies.
The package works by wrapping PyYAML's loader and providing a `load()` function that returns an object with attribute access to configuration keys. References are resolved dynamically when accessed, and you can also dump the resolved configuration back to YAML. It integrates naturally with tools like argparse, allowing command-line arguments to override configuration values that other parts of the config depend on.
Use it for:
- Build configuration files where paths are defined once at the root and reused throughout nested sections.
- Generate environment-specific configs (dev, staging, prod) by changing a few base values and letting references propagate.
- Combine with argparse to override base parameters and have dependent paths update automatically.
- Export resolved configurations to YAML for deployment or documentation without manual path expansion.
- Reduce duplication in large configuration files by centralizing repeated values as references.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds dynamic string interpolation to YAML configuration files, allowing values to reference other parts of the configuration tree using Python format string syntax.
Yes, if you need lightweight configuration templating in YAML. The package is simple, has minimal dependencies, and solves a real problem—avoiding repetition in configuration files. However, maintenance is dormant (last update 2024-04-09), so adopt it only if you can tolerate no active support. The MIT license carries no restrictions. Not suitable if you need active bug fixes or features.
Install
dynamic-yaml on PyPI
pip
pip install dynamic-yamluv
uv add dynamic-yamlpoetry
poetry add dynamic-yamlInstalling dynamic-yaml
Before you install
Low install friction with a single runtime dependency (pyyaml). Maintenance is dormant—last release was 2024-04-09 with no recent commits, though the repository remains active and has not been archived.
License in practice
MIT License permits unrestricted use, modification, and distribution for both commercial and private projects, with only attribution and license notice required.
Quickstart
import dynamic_yaml
with open('config.yaml') as f:
cfg = dynamic_yaml.load(f)
print(cfg.dirs.venv) # Resolves interpolated references
Requires pyyaml to be installed; strings containing braces must be quoted in YAML to distinguish them from mapping syntax.
Verify before relying
- Whether the package handles circular reference detection or will hang on cyclic interpolations.
- Performance characteristics when resolving deeply nested or large configuration trees.
- Compatibility with recent pyyaml versions and Python 3.12+.
Package facts
| License | MIT License Copyright (c) 2022 Liam H. Childs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyyaml |
| Maintenance | dormant — 857 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 576,509/month — #5,929 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dynamic_yaml-2.0.0-py3-none-any.whl
Keywords: yaml, configuration
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
envyamlParses YAML configuration files with…
permissive · top 5,000 on PyPI
HiYaPyCoLoads and merges multiple YAML configuration…
copyleft · top 15,000 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
yamllintyamllint checks YAML files for syntax errors,…
copyleft · top 1,000 on PyPI
yacmanYacman provides a Python interface for reading,…
permissive · top 15,000 on PyPI
anyconfigLoads, dumps, and merges configuration files in…
permissive · top 15,000 on PyPI
HyperPyYAMLExtends YAML syntax with Python-friendly…
permissive · top 5,000 on PyPI
pyamlProduces human-readable, diff-friendly YAML…
permissive · top 5,000 on PyPI
condor-git-configProvides an executable hook that fetches…
permissive · top 15,000 on PyPI
yacsYACS is a lightweight configuration management…
permissive · top 5,000 on PyPI