Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Python Bindings

The Python binding has a book of its own:

dynamic-config for Python

pip install dynamic-config-py                     # the import is `dynamic_config`
pip install dynamic-config-py[pydantic]           # + Pydantic models
pip install dynamic-config-py[msgspec]            # + msgspec Structs
pip install dynamic-config-py[remote]             # + the Rust etcd and Vault clients
from dataclasses import dataclass
from dynamic_config import DynamicConfig

@dataclass
class Database:
    host: str = "localhost"
    port: int = 5432

db = (
    DynamicConfig(Database, key="db")
    .file("config.toml")
    .env("APP_")
    .init_and_current()    # a Database instance — cached, not re-validated
)

Rust resolves, your schema validates, Python reads a cache. This engine does the sources, the layering, the profiles, the watcher, the last-known-good recovery and the provenance; a dataclasses.dataclass, a Pydantic model, a msgspec.Struct or Values does the validating, once per successful resolve rather than once per read.

Why it is a separate book

Because the reader is a different person. Eleven chapters of Python description are not for a Rust programmer, and a Python programmer arriving from PyPI should not land in a sidebar whose first twenty entries are Rust. The store crates are deliberately not this case — a Consul chapter is read by whoever read the builder tour, and half its value is linking inward.

Same site, one link away: the Python book links back here for precedence, document shape, schemaless configuration and telemetry, which are the engine's behaviour rather than a language's surface.

What is in it

ChapterWhat it answers
API ReferenceEvery method, every argument, every default
Callbackson_reload, on_change, scoped guards, the thread a hook runs on
Async & asyncioinit_async, async for config.changes(), which pool pays
Data TypesWhat a schema may be, and what each kind validates
Web FrameworksFastAPI, Flask, Django
Telemetrystatus(), and the Prometheus exposition
Remote StoresA store written in Python, and the second wheel that carries the Rust ones
Implementation DetailsWhat crosses the boundary, and how often
Free-Threaded CPythonThe cp314t wheel, and what was measured
LimitationsWhat it will not do, and why