Configuration management
% start main % start synopsis
This module provides infrastructure for loading, merging, and managing configuration data from multiple sources. It includes:
- Multi-source configuration loading (files, environment, programmatic)
- Hierarchical configuration with automatic merging
- Context-aware configuration access
- Configuration inheritance with
$basereferences - Lazy loading of module-specific configurations
% end synopsis
% end main
Usage
from moat.lib.config import CFG
# Initial setup (once, at program startup)
CFG(name="myapp")
# loads `/etc/myapp.yaml` (and others)
# Access configuration data
print(CFG.database.host)
Configuration Sources
The CfgStore class combines configuration from multiple sources (in order of precedence):
- Command-line arguments (via
modmethod) - Preloaded configuration (passed to constructor)
- Environment variables (in
CfgStore.env) - Explicitly added config files (via
addmethod) - Default config files (from standard paths)
- Static module configurations (loaded via
with_)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
moat_lib_config-0.2.1.tar.gz
(11.0 kB
view details)
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 moat_lib_config-0.2.1.tar.gz.
File metadata
- Download URL: moat_lib_config-0.2.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02a8ec79d284b88c5af49eb0fee0a29d90ed6187de6ac44eddb9db8170506b8d
|
|
| MD5 |
feaab6d0d10c703c4ebab6ac60093f5c
|
|
| BLAKE2b-256 |
6b64ee415f360ccbd869aae64b0cdf2c837eabc7c8f4c90b34593277f9ccd8df
|
File details
Details for the file moat_lib_config-0.2.1-py3-none-any.whl.
File metadata
- Download URL: moat_lib_config-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a48fe9fea8f433d0eab1a893478c18229c1dd4580514d6e2447d3aa65519d2f2
|
|
| MD5 |
13334355523cde43367de575b8be7e2d
|
|
| BLAKE2b-256 |
691277311287f8f5cbd40ae0a97bece147e4f50536f3e6305b2191a51696d672
|