Metadata-Version: 2.4
Name: opendecree
Version: 0.1.0
Summary: Python SDK for OpenDecree — schema-driven configuration management
Author: Zeev Dreifuss
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/zeevdr/decree-python
Project-URL: Documentation, https://github.com/zeevdr/decree
Project-URL: Repository, https://github.com/zeevdr/decree-python
Project-URL: Issues, https://github.com/zeevdr/decree-python/issues
Keywords: config,configuration,decree,grpc,schema,management
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: grpcio<2,>=1.68.0
Requires-Dist: protobuf<7,>=6.31.0
Requires-Dist: googleapis-common-protos<2,>=1.66.0
Provides-Extra: dev
Requires-Dist: pytest>=8.3; extra == "dev"
Requires-Dist: pytest-cov>=6.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: mypy>=1.14; extra == "dev"
Requires-Dist: mypy-protobuf>=3.6; extra == "dev"
Requires-Dist: ruff>=0.8; extra == "dev"
Requires-Dist: grpcio-tools>=1.68.0; extra == "dev"

# OpenDecree Python SDK

[![CI](https://github.com/zeevdr/decree-python/actions/workflows/ci.yml/badge.svg)](https://github.com/zeevdr/decree-python/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/opendecree)](https://pypi.org/project/opendecree/)
[![Python](https://img.shields.io/pypi/pyversions/opendecree)](https://pypi.org/project/opendecree/)
[![Coverage](https://img.shields.io/badge/coverage-98%25-brightgreen)](https://github.com/zeevdr/decree-python)
[![License](https://img.shields.io/github/license/zeevdr/decree-python)](https://github.com/zeevdr/decree-python/blob/main/LICENSE)

Python SDK for [OpenDecree](https://github.com/zeevdr/decree) — schema-driven configuration management.

## Install

```bash
pip install opendecree
```

## Quick Start

```python
from 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%")
```

## Watch for Changes

```python
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}")
```

## Async

```python
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)
```

## Documentation

- [Quick Start](docs/quickstart.md)
- [Configuration](docs/configuration.md)
- [Watching](docs/watching.md)
- [Async Usage](docs/async.md)

For detailed concepts (schemas, typed values, versioning, auth), see the [main OpenDecree docs](https://github.com/zeevdr/decree).

## Requirements

- Python 3.11+
- A running OpenDecree server (v0.3.0+)

## License

Apache License 2.0 — see [LICENSE](https://github.com/zeevdr/decree-python/blob/main/LICENSE).
