ModYaml
ModYaml is a Python module designed for advanced YAML configuration management, offering modular, flexible, and powerful configuration capabilities.
Purpose
The primary purpose of ModYaml is to enhance YAML configurations by providing:
- Modular configuration through file inclusion
- Support for various file sources (local, remote, cloud storage)
- Environment variable interpolation
- Jinja2 templating support
- Ability to disable interpolation for specific values or blocks
These features allow for more dynamic, reusable, and environment-aware configurations.
Syntax
ModYaml extends standard YAML syntax with the following directives:
File Inclusion
key: !include path/to/another/file.yaml
The path/to/another/file.yaml can be: A local file path A URL (http, https, ftp, etc.) A cloud storage path (s3://, gs://, etc.)
ModYaml uses fsspec (Filesystem Specification) to handle file access, supporting a wide range of file systems and protocols.
database:
!include configs/database.yaml
logging:
!include https://example.com/logging-config.yaml
cloud_settings:
!include gs://my-bucket/cloud-config.yaml
Disabling Interpolation
ModYaml provides two ways to disable interpolation when needed:
- For single values using the
!rawtag:
# This value will not be interpolated
config_string: !raw "{{ VARIABLE }}"
- For blocks of text using Jinja2's
{% raw %}and{% endraw %}tags:
text_block: >
{% raw %}
This entire block will not have {{ any }} variables
{{ interpolated }} even though they use the
standard {{ SYNTAX }}.
{% endraw %}
Processing Stages
ModYaml processes your configuration in the following stages:
- File Loading: The main YAML file is loaded, and all !include directives are resolved recursively.
- YAML Parsing: The complete YAML structure (including included files) is parsed into a Python dictionary.
- Jinja2 Templating: The parsed YAML is rendered as a Jinja2 template, allowing for dynamic content generation.
- During this stage, content marked with
!rawor inside{% raw %}{% endraw %}blocks will not be interpolated.
- During this stage, content marked with
- Environment Variable Interpolation: Environment variables are interpolated into the configuration.
- Final Parsing: The resulting string is parsed again as YAML to produce the final configuration dictionary.
Using Environment Variables
Environment variables can be used in your YAML files for flexible configuration and debugging. They are accessible in the Jinja2 templating stage.
Example:
debug_mode: {{ DEBUG | default('false') }}
database_url: {{ DB_URL | default('localhost:5432') }}
# This will preserve the literal text "{{ ENV_VAR }}" without interpolation
raw_value: !raw "{{ ENV_VAR }}"
Debugging configs
It is possible to trigger the config flow processing debug to standard logger. In order to do this, the following environment variables can be used:
export MODYAML_LOG_LEVEL=DEBUG
Metadata
Release files for modyaml 0.0.post27
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| modyaml-0.0.post27.tar.gz | 11.5 kB | With provenance | Details for modyaml-0.0.post27.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| modyaml-0.0.post27-py3-none-any.whl | Python 3 | none | any | Details for modyaml-0.0.post27-py3-none-any.whl |
Total release size: 19.4 kB
Release files / modyaml-0.0.post27.tar.gz
| Download URL | modyaml-0.0.post27.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82b96d01ef766c4c5f575badf44ea159b7e66ed41a2b0716c5d77682043d7b2d
|
|
BLAKE2b-256 checksum How to use checksums |
74d8d544841bd85b13c4957dcb79f0b8d39a88c056365e32d72024fdad5c45fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 19, 2026.
Transparency logRelease files / modyaml-0.0.post27-py3-none-any.whl
| Download URL | modyaml-0.0.post27-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4edf0a553b7fbc2595062e2e8bf98a308646f8d86ccd8edd0ad3381a1415cd40
|
|
BLAKE2b-256 checksum How to use checksums |
f056552aa1e378c0c7976a7fc699969f865cfb9fe67b8a769707d8ec4d9dadcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 19, 2026.
Transparency logSecurity for modyaml 0.0.post27
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for modyaml-0.0.post27.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.