skillfed

dynamic-yaml

Enables self referential yaml entries

dynamic-yaml v2.0.0 576.5K downloads/30d#5,929 on PyPI45
Permissive 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) DORMANT released

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-yaml

uv

uv add dynamic-yaml

poetry

poetry add dynamic-yaml

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3

Tags

yaml configuration interpolationself-referential yamldynamic yaml referencesyaml variable substitutionyaml config templatingnested yaml referencesyaml string formatting
yaml-configconfiguration-management

More Utilities packages