A lightweight, strategy-driven engine to dynamically discover and recursively deep-merge layered YAML configurations.
Project description
Dynamic Configuration Loader
A lightweight, production-grade, strategy-driven configuration orchestration engine designed to dynamically discover, alphabetically sort, and recursively deep-merge multi-layered YAML configurations across variable filesystem paths.
Copyright (C) 2026 Avinash Kumar
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Core Features
- Layered Ingestion Architecture: Seeds a master configuration matrix from a static baseline file and patches runtime override layers over it dynamically.
- Dynamic Multi-Directory Scanning: Discovers and processes external asset folders via an isolated environment variable vector (
PYTHON_ADDITIONAL_CONFIG). - Deterministic Processing Loop: Enforces explicit alphabetical sorting on all discovered override files to make overlapping configuration mutations completely predictable.
- Recursive Deep Merges: Protects nested dictionary tracking structures from structural wiping or collision drops during runtime updates.
- Zero Bulk Dependencies: Relies entirely on native Python system standards and
pyyamlfor all parsing metrics.
Installation
Ensure your Python environment is active and run the package requirements installer command:
pip install -r requirements.txt
Your requirements.txt file must contain:
pyyaml==6.0.1
Quick Start & Usage
1. Define Your Configuration Architecture
Set up your files to match this example structural multi-layer layout:
Baseline File: test_configs/base_config.yaml
app_name: "Production Gateway"
debug_mode: false
database:
host: "127.0.0.1"
port: 5432
pool_size: 20
Override Patch File: test_configs/overrides/01_dev_patch.yaml
debug_mode: true
database:
host: "internal-dev-cluster.local"
2. Execute the Loader Code
Import the engine into your main execution entry point script (e.g., run.py):
import os
import json
from src.dynamic_config_loader import DynamicConfigLoader
# 1. Point the system context env variable to your overrides directory
os.environ["PYTHON_ADDITIONAL_CONFIG"] = "./test_configs/overrides, ./test_configs/someotherdir"
# 2. Instantiate the loading engine with your baseline tracking path
loader = DynamicConfigLoader(default_config_path="./test_configs/base_config.yaml")
# 3. Trigger the ingestion engine pipeline loop
final_config = loader.load()
# 4. Access your compiled matrix data properties safely
print(json.dumps(final_config, indent=4))
3. Expected Output Matrix
{
"app_name": "Production Gateway",
"debug_mode": true,
"database": {
"host": "internal-dev-cluster.local",
"port": 5432,
"pool_size": 20
}
}
Automated Unit Testing
This project includes a dedicated validation testing suite that leverages Python's built-in unittest module, requiring zero external dependencies.
Running the Tests via Terminal
To verify that the configuration loader and the deep merge logic are working correctly, run the standard Python test discovery command from the root folder of your project:
python -m unittest discover -s tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dynamic_config_loader-1.0.0.tar.gz.
File metadata
- Download URL: dynamic_config_loader-1.0.0.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7b5679f40785e2b8f0aa558e3640164e7d0ab74e1ab268d1b702ef858002964
|
|
| MD5 |
383f68a7241d0d69aa70873ed77e5e5d
|
|
| BLAKE2b-256 |
78ddd108c88f0b3d091730ca347f92946efc0f0154a8d0e6a0713d246ff5ac64
|
File details
Details for the file dynamic_config_loader-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dynamic_config_loader-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00713619734df3de7fa653ccb033f1871d805ed1e1c0983f8e9506b52d573b33
|
|
| MD5 |
cec83214b681b86ebd9dd3397945d54f
|
|
| BLAKE2b-256 |
15bb4616a817e5d49fba3a74678cf606153ffb564d6582c702effaae807852e9
|