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.
Installation
pip install mxm-config
Usage
Installing configuration
from mxm.config import install_config, DefaultsMode
install_config(
app_id="demo",
mode=DefaultsMode.shipped,
shipped_package="mxm.config._data.seeds",
)
Loading configuration
from mxm.config import load_config
cfg = load_config(package="demo", env="dev", profile="research")
print(cfg.parameters.refresh_interval)
print(cfg.paths.output)
CLI usage
mxm-config install-config --app-id demo --mode shipped --pkg mxm.config
Design Principles
-
Separation of concerns
Configuration ≠ secrets ≠ runtime
Secrets are handled bymxm-secrets
Runtime metadata will be handled bymxm-runtime(planned) -
Determinism
Fixed layering order
Reproducible resolution -
Transparency
Plain YAML files
Explicit merge order -
Extensibility
Orthogonal layers
Package-level defaults
The App-Owned Config Root
Every MXM application owns a configuration directory:
~/.config/mxm/<app_id>/
This is the single source of truth for runtime configuration.
Override with:
export MXM_CONFIG_HOME=/custom/path
Configuration Layers
Configuration is resolved by merging the following layers (lowest → highest precedence):
default.yamlenvironment.yamlmachine.yamlprofile.yamllocal.yaml- explicit overrides
Installing Configs (Python API)
from mxm.config import install_config, DefaultsMode
from importlib.resources import as_file, files
install_config(
app_id="demo",
mode=DefaultsMode.shipped,
shipped_package="mxm.config._data.seeds",
)
with as_file(files("mxm.config._data") / "seeds") as p:
install_config(app_id="demo", mode=DefaultsMode.seed, seed_root=p)
install_config(app_id="demo", mode=DefaultsMode.empty)
Returns an InstallReport describing all actions taken.
Install Modes
| Mode | Description |
|---|---|
shipped |
Install packaged defaults |
seed |
Install from local filesystem |
empty |
Create empty config root |
Command-Line Interface
mxm-config --help
Example:
mxm-config install-config \
--app-id demo \
--mode shipped \
--pkg mxm.config
Shipped Defaults
Default configuration files are located in:
src/mxm/config/_data/seeds/
These are bundled with the package and used for both runtime defaults and testing.
Development
make check
This runs:
- Ruff (lint + import sorting)
- Black (format check)
- Isort (consistency check)
- Pyright (type checking)
- Pytest (tests)
Testing
make test
Tests run in isolated temporary directories and never touch real user configuration.
Roadmap
- Schema validation (
omegaconf.structured,pydantic) - Environment variable overrides
- Integration with
mxm-runtime - Configuration hashing and provenance tracking
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.5.2.tar.gz.
File metadata
- Download URL: mxm_config-0.5.2.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b55e7bedb581dabc55875da8f9f724b9bbf36462419cf696f789a0f244fa7326
|
|
| MD5 |
5134c20f6ba6537822bdf063a231fd91
|
|
| BLAKE2b-256 |
7a35606ce3a2b618b2cf12bdd449848888549eee93dcd4f8a6a8cceb79f6456e
|
Provenance
The following attestation bundles were made for mxm_config-0.5.2.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.5.2.tar.gz -
Subject digest:
b55e7bedb581dabc55875da8f9f724b9bbf36462419cf696f789a0f244fa7326 - Sigstore transparency entry: 1461158460
- Sigstore integration time:
-
Permalink:
moneyexmachina/mxm-config@d1e47e47083942e93a6922ca7d3d33d0054b58a7 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/moneyexmachina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d1e47e47083942e93a6922ca7d3d33d0054b58a7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mxm_config-0.5.2-py3-none-any.whl.
File metadata
- Download URL: mxm_config-0.5.2-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dac8c05f3d7a3f364f47e012da15eb6948435f32d6950dc6c64331223005ab27
|
|
| MD5 |
06b5b98346e5d7c8513fa9f1b3715002
|
|
| BLAKE2b-256 |
607805ae183b46f15a36d94298ff1e2bade1f8da851ececfe3d25aadde55c025
|
Provenance
The following attestation bundles were made for mxm_config-0.5.2-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.5.2-py3-none-any.whl -
Subject digest:
dac8c05f3d7a3f364f47e012da15eb6948435f32d6950dc6c64331223005ab27 - Sigstore transparency entry: 1461158602
- Sigstore integration time:
-
Permalink:
moneyexmachina/mxm-config@d1e47e47083942e93a6922ca7d3d33d0054b58a7 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/moneyexmachina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d1e47e47083942e93a6922ca7d3d33d0054b58a7 -
Trigger Event:
push
-
Statement type: