chumicro-config¶
Typed runtime configuration for ChuMicro libraries.
Every library reads its settings from one deployed runtime_config.msgpack using dotted keys. The app loads that file once at boot and hands the whole config to each library, which pulls its own prefix off it: wifi.ssid becomes WifiConfig.ssid, mqtt.broker.host becomes the broker the MQTT client dials.
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
No board running yet? Start here goes from a new board to your own code running on it. Installing libraries covers registering the bundle, the experimental channel, and the pre-compiled .mpy packages.
Quick example¶
from chumicro_config import load_runtime_config
from chumicro_wifi import WifiConfig, WifiService
config = load_runtime_config()
wifi = WifiService(WifiConfig.from_config(config))
Documentation¶
- User Guide: writing a
from_configfor your own library, soft loading withtry_load_section, exception handling, the on-device config shape - API Reference:
load_runtime_config,load_section,RuntimeConfig, and the config exceptions