Python SDK for OpenDecree — schema-driven configuration management.
Alpha — This SDK is under active development. APIs and behavior may change without notice between versions.
pip install opendecreefrom opendecree import ConfigClient
with ConfigClient("localhost:9090", subject="myapp") as client:
# Get config values (default: string)
fee = client.get("tenant-id", "payments.fee")
# Typed gets via overload
retries = client.get("tenant-id", "payments.retries", int)
enabled = client.get("tenant-id", "payments.enabled", bool)
# Set values
client.set("tenant-id", "payments.fee", "0.5%")with ConfigClient("localhost:9090", subject="myapp") as client:
with client.watch("tenant-id") as watcher:
fee = watcher.field("payments.fee", float, default=0.01)
enabled = watcher.field("payments.enabled", bool, default=False)
if enabled:
print(f"Current fee: {fee.value}")
@fee.on_change
def on_fee_change(old: float, new: float):
print(f"Fee changed: {old} -> {new}")from opendecree import AsyncConfigClient
async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
val = await client.get("tenant-id", "payments.fee")
retries = await client.get("tenant-id", "payments.retries", int)Runnable examples in the examples/ directory:
| Example | What it shows |
|---|---|
| quickstart | Context manager, typed get(), set() |
| async-client | async with, await, asyncio.gather() |
| live-config | ConfigWatcher, @on_change, changes() |
| fastapi-integration | Async watcher as FastAPI lifespan dependency |
| error-handling | RetryConfig, nullable=True, error hierarchy |
For detailed concepts (schemas, typed values, versioning, auth), see the main OpenDecree docs.
- Python 3.11+
- A running OpenDecree server (v0.3.0+)
Head to OpenDecree Discussions — our community hub covers all OpenDecree repos.
Apache License 2.0 — see LICENSE.