MXM configuration loader and context resolver
Project description
mxm-config
Purpose
mxm-config provides deterministic configuration resolution for Money Ex Machina (MXM) applications.
It resolves configuration from an external configuration store using a RuntimeIdentity, applies a fixed layering model, and returns a transparent and reproducible configuration view for the running application.
mxm-config is responsible for configuration resolution only.
It does not manage secrets, discover runtime identity, or own configuration storage.
Installation
pip install mxm-config
Usage
Loading configuration
from pathlib import Path
from mxm.config import load_config
from mxm.types import RuntimeIdentity
identity = RuntimeIdentity(
app="mxm-moneymachine",
environment="dev",
machine="bridge",
substrate="local-process",
role="marketdata",
)
cfg = load_config(
identity=identity,
store_root=Path("~/mxm-config-store").expanduser(),
)
print(cfg.parameters.refresh_interval)
print(cfg.paths.output)
Using the default config store
from mxm.config import load_config
cfg = load_config(identity=identity)
By default, mxm-config resolves configuration from:
~/mxm-config-store
Design Principles
Separation of Concerns
Configuration, secrets, and runtime identity are separate concerns.
mxm-runtime
discovers RuntimeIdentity
mxm-config
resolves configuration
mxm-secrets
resolves secrets
Determinism
Configuration resolution follows a fixed precedence order.
The same RuntimeIdentity and configuration store will always produce the same resolved configuration.
Transparency
Configuration is stored as plain YAML files.
Layer selection and merge order are explicit and inspectable.
Composability
Each configuration layer expresses a single concern.
Applications compose behavior through layering rather than duplication.
Configuration Store
mxm-config resolves configuration from an external configuration store.
The configuration store is the authoritative source of configuration data.
A typical store layout is:
mxm-config-store/
└── apps/
└── <app_id>/
├── default.yaml
├── environment.yaml
├── machine.yaml
├── substrate.yaml
└── role.yaml
The configuration store contains configuration data only.
Configuration resolution semantics belong to mxm-config.
Runtime Identity
Configuration selection is driven by a RuntimeIdentity.
RuntimeIdentity
├── app
├── environment
├── machine
├── substrate
└── role
Each identity dimension selects a configuration layer from the store.
Configuration Layers
Configuration is resolved by merging the following layers (lowest → highest precedence):
default.yamlenvironment.yamlmachine.yamlsubstrate.yamlrole.yaml- explicit overrides
For a runtime identity:
app = mxm-moneymachine
environment = dev
machine = bridge
substrate = local-process
role = marketdata
the resolver selects:
default.yaml
environment.yaml["dev"]
machine.yaml["bridge"]
substrate.yaml["local-process"]
role.yaml["marketdata"]
and merges them in order.
Python API
Loading configuration
cfg = load_config(
identity=identity,
store_root=Path("~/mxm-config-store"),
)
Explicit overrides
cfg = load_config(
identity=identity,
overrides={
"parameters.refresh_interval": 60,
},
)
Command-Line Interface
mxm-config --help
Example:
mxm-config show-config \
--app mxm-moneymachine \
--environment dev \
--machine bridge \
--substrate local-process \
--role marketdata
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 use temporary configuration stores.
Roadmap
- Schema validation
- Configuration provenance reporting
- Configuration hashing
- Layer introspection and diagnostics
- RuntimeContext integration
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.6.1.tar.gz.
File metadata
- Download URL: mxm_config-0.6.1.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99e5cd7261b0b2019bcfe96074f7a7261d04158f256c552ce3294b34cd558458
|
|
| MD5 |
7180261eb6416d30af158510ed1a21a0
|
|
| BLAKE2b-256 |
67a3d96e885213cbf89a486f77783db79811a597e65c774647994153e630d53d
|
Provenance
The following attestation bundles were made for mxm_config-0.6.1.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.6.1.tar.gz -
Subject digest:
99e5cd7261b0b2019bcfe96074f7a7261d04158f256c552ce3294b34cd558458 - Sigstore transparency entry: 1800556184
- Sigstore integration time:
-
Permalink:
moneyexmachina/mxm-config@83e6bf3d953fdbeac2c90b1d13d00fced15c5a8c -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/moneyexmachina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83e6bf3d953fdbeac2c90b1d13d00fced15c5a8c -
Trigger Event:
push
-
Statement type:
File details
Details for the file mxm_config-0.6.1-py3-none-any.whl.
File metadata
- Download URL: mxm_config-0.6.1-py3-none-any.whl
- Upload date:
- Size: 11.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 |
add44b3aa1e1eda8b683f5719048eed02325cefc54c32b3cdec098f0a98ad71a
|
|
| MD5 |
00fbb10a4ee02888d7e95e35f38ce21e
|
|
| BLAKE2b-256 |
70298c360126b935e451381cc1eea0ff84deb2403316c764257dc7d145c10e98
|
Provenance
The following attestation bundles were made for mxm_config-0.6.1-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.6.1-py3-none-any.whl -
Subject digest:
add44b3aa1e1eda8b683f5719048eed02325cefc54c32b3cdec098f0a98ad71a - Sigstore transparency entry: 1800556724
- Sigstore integration time:
-
Permalink:
moneyexmachina/mxm-config@83e6bf3d953fdbeac2c90b1d13d00fced15c5a8c -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/moneyexmachina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83e6bf3d953fdbeac2c90b1d13d00fced15c5a8c -
Trigger Event:
push
-
Statement type: