chumicro-config
Runtime config from one shared dotted-key shape (wifi.ssid, mqtt.broker.host).
Each library exposes a <Name>Config.from_config() factory that reads its own dotted-prefix section from a shared dict (wifi.*, mqtt.broker.*, etc.) and returns typed configuration. Apps load one runtime_config.msgpack at boot; libraries pull their slice out. No global registry, no hand-written if "key" in config: walls.
Part of the ChuMicro family: small, focused Python libraries for microcontrollers and laptops. Browse all libraries.
Install
# CircuitPython (after `circup bundle-add ChuMicro/ChuMicro-Bundle`)
circup install chumicro_config
# MicroPython
mpremote mip install github:ChuMicro/ChuMicro-Bundle/chumicro_config
# CPython
pip install chumicro-config
For bundle setup, pre-compiled .mpy bundles, the experimental channel, and details on PyPI naming, see the chumicro INSTALL guide.
Quick example
User-app pattern (the 2-line bring-up):
from chumicro_config import load_runtime_config
from chumicro_wifi import WifiConfig, WifiService
config = load_runtime_config() # reads /runtime_config.msgpack
wifi = WifiService(WifiConfig.from_config(config)) # reads + types the wifi.* keys
Library-side pattern (load_section builds a typed config from the flat-key payload, used today by chumicro-wifi):
from chumicro_config import load_section
class WifiConfig:
def __init__(self, ssid, password, hostname=None, connect_timeout_ms=15_000): ...
@classmethod
def from_config(cls, config):
return load_section(
cls, config,
prefix="wifi",
required=("ssid", "password"),
optional={"hostname": None, "connect_timeout_ms": 15_000},
)
What's included
| Symbol | What it does |
|---|---|
load_runtime_config(path=…) |
Read + decode /runtime_config.msgpack into a flat-key RuntimeConfig (dict-shaped) |
config |
Lazily-loaded module attribute: the deployed RuntimeConfig, or None when the file is absent. First attribute access reads the file once and caches the result |
RuntimeConfig |
Lookup wrapper over the flat-key payload: get(key[, default]), [key] / require(key), in check |
load_section(cls, config, *, prefix, required=…, optional=…) |
Build cls(**kwargs) by reading flat-prefix keys. Used today by chumicro-wifi's WifiConfig.from_config; available to any library whose constructor signature maps 1:1 to its config subkeys |
try_load_section(...) |
Soft variant: returns None instead of raising when config is None, the wrong type, or missing a required key |
MissingConfigKey / InvalidConfigType / ConfigError |
Targeted exceptions: single-inheritance from ConfigError (MicroPython forbids multi-parent layouts) |
Where this fits
Depends on chumicro-msgpack for decode. Most ChuMicro libraries with a <Name>Config.from_config() factory read their slice off the shared RuntimeConfig via config.get(...); chumicro-wifi additionally uses the load_section helper here. Other consumers: chumicro-mqtt, chumicro-ntp, chumicro-requests, chumicro-websockets, chumicro-http_server.
Platform support
Works on CPython, MicroPython, and CircuitPython.
Examples
examples/end_to_end.py shows the full read → load_section → typed-config flow on CPython; see any consumer library (starting with chumicro-wifi) for the integrated usage shape.
Contributing
Issues, bug reports, and pull requests are welcome, and so is "I ran it on this board and here's what happened", some of the most useful feedback a hardware project can get. Development happens in the ChuMicro repository, whose contributing guide covers setup and the test workflow.
Docs
📖 Stable docs · Experimental docs
Find this library
- PyPI: chumicro-config
- Bundle: ChuMicro-Bundle (CircuitPython & MicroPython)
- Experimental bundle: ChuMicro-Bundle-Experimental
- Source: libraries/config
License
Metadata
Release files for chumicro-config 0.7.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chumicro_config-0.7.7.tar.gz | 15.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chumicro_config-0.7.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.3 kB
Release files / chumicro_config-0.7.7.tar.gz
| Download URL | chumicro_config-0.7.7.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a43a0b271102ea7476ab53d9cdcbf9109953460a7e3ad97ebd25aca700dcd0af
|
|
BLAKE2b-256 checksum How to use checksums |
4e859edf23ca2368ab92c2317e965697c8c9ecbcfad512766df3cc40075fabb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / chumicro_config-0.7.7-py3-none-any.whl
| Download URL | chumicro_config-0.7.7-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
869ee0d7947b4a0f584c6e02dcff82b891b0c96a00cc112aa82e344029b9a3f1
|
|
BLAKE2b-256 checksum How to use checksums |
957dc527281f40b12f015955b6a7c407abd28ee50ec5312e1200b01e0f2f819a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency log