Skip to main content

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:

  1. Modular configuration through file inclusion
  2. Support for various file sources (local, remote, cloud storage)
  3. Environment variable interpolation
  4. Jinja2 templating support

These features allow for more dynamic, reusable, and environment-aware configurations.

Syntax

ModYaml extends standard YAML syntax with the !include directive:

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

Processing Stages

ModYaml processes your configuration in the following stages:

  1. File Loading: The main YAML file is loaded, and all !include directives are resolved recursively.
  2. YAML Parsing: The complete YAML structure (including included files) is parsed into a Python dictionary.
  3. Jinja2 Templating: The parsed YAML is rendered as a Jinja2 template, allowing for dynamic content generation.
  4. Environment Variable Interpolation: Environment variables are interpolated into the configuration.
  5. 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') }}

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.post15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modyaml 0.0.post15
File Size Uploaded Provenance Actions
modyaml-0.0.post15.tar.gz 3.4 kB Without provenance Details for modyaml-0.0.post15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for modyaml 0.0.post15
File Interpreter ABI Platform Actions
modyaml-0.0.post15-py3-none-any.whl Python 3 none any Details for modyaml-0.0.post15-py3-none-any.whl

Total release size: 6.2 kB

Release files / modyaml-0.0.post15.tar.gz

Download URL modyaml-0.0.post15.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3930c827639ba196aecd6c8812e5df07827d4a48e46a312ae65a7428198c49d8
BLAKE2b-256 checksum
How to use checksums
be41deb793b8642f798f3e65669a2ee8489d12ad4006cb31c411f53075dff5a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / modyaml-0.0.post15-py3-none-any.whl

Download URL modyaml-0.0.post15-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a3d4873c5ac5cb5a08249065aa750b45ce608ab9cf28971fb87a2679b31324b
BLAKE2b-256 checksum
How to use checksums
40d5883cc06b78aaa8ba68670aea4ed1295987f09ab2e18e9681f6c6933b20e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Security for modyaml 0.0.post15

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page