This release is a pre-release and may not be stable for production use.
cfgx
Python configs with ordered composition, computed values, and CLI overrides. Loading produces an ordinary dictionary. Configuration logic stays in Python.
pip install cfgx
Define a base:
# base.py
from cfgx import final
config = {
"steps": 96_000,
"lr": 3e-4,
"backbone_lr": final.lr * 0.1,
"cooldown_steps": final.steps // 10,
}
Compose a variant with a tuple of sources:
# finetune.py
from cfgx import value
config = "base.py", {"steps": 48_000, "lr": value * 0.5}
Load it with optional overrides:
from cfgx import load
cfg = load("finetune.py", overrides=["lr=expr:value * 0.1"])
assert cfg["steps"] == 48_000
assert cfg["backbone_lr"] == cfg["lr"] * 0.1
Dictionaries merge recursively, including computed dictionaries. Lists and tuples
replace earlier sequences. Use replace(x) to replace a dictionary and delete
to remove a dictionary entry.
final.lrreads the complete config, including later files and overrides.valuereads the inherited value at the current location.previous.lrreads earlier definitions at another path.final(1).lrreads a sibling;previous(1).lrreads its inherited definition.expr.map(fn)transforms a resolved value.expr.map("x * 2")is shorthand.computed(lambda get: ...)supports dynamic, conditional reads withget(expr)..default(...),.keys(),.len(), and.exists()compose with other expressions.
from cfgx import computed, delete, final
config = {
"resume": False,
"checkpoint": computed(
lambda get: get(final.checkpoint_path) if get(final.resume) else delete
),
}
Exact built-in dictionaries, lists, and tuples are rebuilt independently for each output location. Other objects are opaque and retain identity. Avoid side effects when working with opaque values or unknown types.
See composition, expressions, overrides, and the resolution contract. Training example demonstrates a compact setup with model and dataset composition, learning-rate scaling, computed checkpoints, and dataset transformations.
Snapshots and formatting remain available through dump, dumps, and format.
A snapshot preserves resolved values, not their formulas.
Metadata
Release files for cfgx 0.6.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cfgx-0.6.0a1.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cfgx-0.6.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.2 kB
Release files / cfgx-0.6.0a1.tar.gz
| Download URL | cfgx-0.6.0a1.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53328fc648f9524276cc55adc30a650505c1c4b1366a1b1dce46a4c455f76d8c
|
|
BLAKE2b-256 checksum How to use checksums |
a860ffa7f7eadf1046272943ae7dc32dffa929659a790582c928fb43584d294b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / cfgx-0.6.0a1-py3-none-any.whl
| Download URL | cfgx-0.6.0a1-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d272167866e904f44bc043fa7261374daa18ac12160c8cdb4cacf6ab7adc996e
|
|
BLAKE2b-256 checksum How to use checksums |
ae279625a25804c13f5be0617061596a9a867fed8ba9d6d5b76b34362c57b14b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|