skillfed

HyperPyYAML

Extensions to YAML syntax for better python interaction

hyperpyyaml v1.2.3 1.9M downloads/30d#3,492 on PyPI80
Permissive license AGING released

What it is and what it does

HyperPyYAML is a YAML extension library that adds Python-specific syntax to make configuration files more expressive and less repetitive. It lets you instantiate Python objects directly in YAML using `!new:` tags, define reusable references with `!ref` that support string interpolation and nested lookups, and implicitly parse tuples from parenthesized strings. The package depends on pyyaml and ruamel.yaml as runtime dependencies.

It's designed for data-analysis workflows where hyperparameters need to be easily examined, modified, and cross-referenced without cluttering Python code. You load a YAML file with `load_hyperpyyaml()`, optionally override values at runtime, and get back a fully-constructed configuration object with all references resolved and objects instantiated. The trade-off is that loading YAML allows arbitrary code execution—a feature, not a bug, but one that requires you to trust or audit any YAML files you load.

Use it for:

  • Define machine-learning experiment hyperparameters in YAML with cross-references that auto-update when you change a base value.
  • Instantiate complex nested objects (models, counters, custom classes) directly in configuration files without Python boilerplate.
  • Override specific hyperparameters at runtime (e.g., learning rate, batch size) without editing the YAML file itself.
  • Share reproducible experiment configs that reference each other and compute derived values via interpolation.
  • Avoid scattering magic numbers and object constructors throughout Python analysis code by centralizing them in a single YAML file.

Worth the install?

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

Extends YAML syntax with Python-friendly features like object instantiation, smart aliases with interpolation, and implicit tuple support for cleaner hyperparameter configuration files.

Yes, if you manage hyperparameter-heavy projects and want cleaner, more maintainable config files. The low install friction, permissive license, and active repository make it a safe choice. Be aware that loading YAML executes arbitrary Python code—audit any untrusted configs. Aging maintenance status suggests stable rather than rapidly evolving, which is appropriate for a focused utility.

Install

hyperpyyaml on PyPI

pip

pip install hyperpyyaml

uv

uv add hyperpyyaml

poetry

poetry add hyperpyyaml

Installing HyperPyYAML

Before you install

Low friction—pure Python wheel with just two YAML library dependencies (pyyaml and ruamel.yaml). Last release was recent; repo is active and not archived, though maintenance status is aging.

License in practice

Licensed under Apache 2.0 (permissive). No restrictions on commercial or private use; attribution required but no copyleft obligations.

Quickstart

pip install hyperpyyaml

from hyperpyyaml import load_hyperpyyaml

yaml_str = """model: !new:collections.Counter
folder: abc/def
ref_folder: !ref /"""
config = load_hyperpyyaml(yaml_str)
print(config['model'])

Loading untrusted YAML files allows arbitrary code execution—verify all YAML sources before loading, as documented in the package's security note.

Verify before relying

  • Whether the package works with all modern Python versions (requires_python is unspecified in metadata).
  • Current maintenance velocity and whether aging status indicates reduced active development or stable maintenance.

Package facts

License not declared (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — pyyaml, ruamel.yaml
Maintenance aging — 225 days since the last release
Last repo commit
First released
Downloads 1,852,618/month — #3,492 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: hyperpyyaml-1.2.3-py3-none-any.whl

License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3

Tags

yaml hyperparameter configurationpython yaml extensionsyaml object instantiationyaml string interpolationexperiment config filesyaml with python objectshyperparameter yaml loader
configuration-managementhyperparameter-tuningyaml-extensions

More Utilities packages