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}")Fork safety: gRPC channels are not fork-safe. Create
ConfigClient(and start any watcher) after forking — not before. See Fork safety for details.
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.
Each release wheel is signed with Sigstore via the GitHub Actions OIDC identity. Attestations are visible on the PyPI project page.
To verify a downloaded wheel locally:
pip download opendecree --no-deps
gh attestation verify opendecree-*.whl --repo opendecree/decree-pythonSee decree#16 for the org-wide attestation plan.
- 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.