MXM configuration loader and context resolver
Project description
mxm-config
Purpose
mxm-config provides a unified way to install, load, layer, and resolve configuration across all Money Ex Machina (MXM) packages and applications.
It separates configuration from secrets and runtime metadata, enforces deterministic layering, and ensures every run has a transparent, reproducible view of its operating context.
Design Principles
-
Separation of concerns
- Configuration ≠ secrets ≠ runtime.
- Secrets are handled by
mxm-secrets. - Runtime metadata will be handled by
mxm-runtime(planned).
-
Determinism
- Configuration is layered in a fixed, documented order.
- Reproducible runs: the same context always produces the same resolved config.
-
Transparency
- Configs are plain YAML files, no hidden state.
- Merging order is explicit and testable.
-
Extensibility
- Layers are minimal and orthogonal.
- New packages can register defaults without breaking existing ones.
Configuration Layers
At runtime, configuration is resolved by merging up to six layers in order of precedence (lowest → highest):
-
default.yaml
Baseline shipped with the package.
Always present. -
environment.yaml
Deployment mode (dev,prod, …).
Each environment is a block inside this file. -
machine.yaml
Host-specific overrides (paths, mounts, resources). -
profile.yaml
Role or user context (research,trading, …). -
local.yaml
Local scratchpad for ad-hoc tweaks.
Ignored by version control. -
Explicit overrides (dict)
Passed directly in code, applied last.
Installing Configs
Use the installer to copy package-shipped configs into the user’s config root (~/.config/mxm/ by default, override with $MXM_CONFIG_HOME).
from mxm_config.installer import install_all
install_all("mxm_config.examples.demo_config", target_name="demo")
This creates:
~/.config/mxm/demo/default.yaml
~/.config/mxm/demo/environment.yaml
~/.config/mxm/demo/machine.yaml
~/.config/mxm/demo/profile.yaml
~/.config/mxm/demo/local.yaml
Any templates/*.yaml files shipped with the package will also be installed under ~/.config/mxm/<package>/templates/.
Loading Configs
from mxm_config.loader import load_config
cfg = load_config("demo", env="dev", profile="research")
print(cfg.parameters.refresh_interval)
print(cfg.paths.output)
- Context (
mxm_env,mxm_profile,mxm_machine) is injected automatically. - All
${...}interpolations are resolved before returning. - The returned config is read-only by default.
Example Package
The repo ships a minimal demo package: mxm_config/examples/demo_config
default.yaml→ valid baselineenvironment.yaml→ definesdevandprodmachine.yaml→ overrides per host (bridge,wildling,monolith)profile.yaml→ definesresearch,tradinglocal.yaml→ local overrides (optional, not versioned)
This serves as a test fixture for installers and loaders.
Testing
Tests use pytest with monkeypatch to isolate config roots and hostnames.
Run with:
poetry run pytest
Roadmap
- Config schema validation (via
omegaconf.structuredor pydantic) - CLI tool (
mxm-config install demo) - Environment variable overrides → auto-mapped into overrides dict
- Integration with
mxm-runtimefor provenance tracking - Config hashing for reproducibility and auditability
License
MIT License. See LICENSE.
Project details
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 mxm_config-0.2.5.tar.gz.
File metadata
- Download URL: mxm_config-0.2.5.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a57f17baaf216440d86e5e66ff54a53c22b5e23ab5a015d1574c3b57b8cd873e
|
|
| MD5 |
6d82af61ec93a3660239e9660a03f3a5
|
|
| BLAKE2b-256 |
4d3e242765c4e71c93923234842ec7b677d2708decdac71b467338278dc8deea
|
Provenance
The following attestation bundles were made for mxm_config-0.2.5.tar.gz:
Publisher:
release.yml on moneyexmachina/mxm-config
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mxm_config-0.2.5.tar.gz -
Subject digest:
a57f17baaf216440d86e5e66ff54a53c22b5e23ab5a015d1574c3b57b8cd873e - Sigstore transparency entry: 622071291
- Sigstore integration time:
-
Permalink:
moneyexmachina/mxm-config@98312845bcab8bfab0c0d63ba243f57a19c711dc -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/moneyexmachina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@98312845bcab8bfab0c0d63ba243f57a19c711dc -
Trigger Event:
push
-
Statement type:
File details
Details for the file mxm_config-0.2.5-py3-none-any.whl.
File metadata
- Download URL: mxm_config-0.2.5-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0643f9e17c486dae858209ef91fb2dece9d74594b930cee6700dfed38e96b8ef
|
|
| MD5 |
0428f4488630c3e8194450d0551407e3
|
|
| BLAKE2b-256 |
3470a19681b1ed64ce1b6127e7150dece2da52a5dfd248f706657e7e3f2c8341
|
Provenance
The following attestation bundles were made for mxm_config-0.2.5-py3-none-any.whl:
Publisher:
release.yml on moneyexmachina/mxm-config
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mxm_config-0.2.5-py3-none-any.whl -
Subject digest:
0643f9e17c486dae858209ef91fb2dece9d74594b930cee6700dfed38e96b8ef - Sigstore transparency entry: 622071293
- Sigstore integration time:
-
Permalink:
moneyexmachina/mxm-config@98312845bcab8bfab0c0d63ba243f57a19c711dc -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/moneyexmachina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@98312845bcab8bfab0c0d63ba243f57a19c711dc -
Trigger Event:
push
-
Statement type: