Skip to content

Commit 45d17ed

Browse files
authored
docs: consolidate doc trees into mkdocs site, remove stale sdk/docs (#140)
The SDK shipped two divergent doc trees: the published mkdocs site (docs/) and a pdoc-era tree (sdk/docs/) that had drifted out of sync, including a set_many() example that passed a dict instead of a list of FieldUpdate objects. Both READMEs linked to the stale tree. Pick docs/ (mkdocs) as the single canonical tree: - Migrate the async usage guide into docs/guide/async.md, fixing the stale set_many() dict example to use FieldUpdate and updating cross links to match the mkdocs nav structure. (The configuration/error handling content in sdk/docs/ was superseded by the more accurate guide/connect.md, which already documents check_version, RESOURCE_EXHAUSTED retries, and TimeoutError, so it was dropped rather than migrated.) - Add the new guide to mkdocs.yml's nav and cross-link it from docs/index.md and docs/guide/watch.md. - Remove sdk/docs/ entirely, along with the pdoc wiring that generated its stale sdk/docs/api/*.html (Makefile `docs` target, the pdoc dependency in build/Dockerfile.tools and sdk/pyproject.toml, and the matching .gitignore entry). The Makefile `docs` target now builds the mkdocs site directly, matching what .github/workflows/docs.yml does. - Repoint README.md and sdk/README.md documentation links at the published docs site (opendecree.github.io/decree-python) instead of the removed sdk/docs/ tree, and update CLAUDE.md's tooling table. Closes #135
1 parent d9ef07c commit 45d17ed

14 files changed

Lines changed: 49 additions & 525 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ htmlcov/
3434
.ruff_cache/
3535

3636
# Generated docs
37-
sdk/docs/api/
37+
site/
3838

3939
# OS
4040
.DS_Store

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ clients, a field-watching subscription layer, and optional OpenTelemetry instrum
1616
| Lint / format | ruff |
1717
| Type checking | mypy |
1818
| Tests | pytest, pytest-asyncio |
19-
| Docs | pdoc |
19+
| Docs | mkdocs (material) + mkdocstrings |
2020

2121
## Development
2222

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ integration: $(TOOLS_SENTINEL)
6464
@test -n "$(DECREE_TEST_ADDR)" || (echo "Set DECREE_TEST_ADDR=host:port" && exit 1)
6565
$(DOCKER_RUN_ROOT) sh -c "cd sdk && pip install -e . -q 2>/dev/null && DECREE_TEST_ADDR=$(DECREE_TEST_ADDR) pytest -m integration -v"
6666

67-
## docs: Generate API reference HTML from docstrings (pdoc)
68-
docs: $(TOOLS_SENTINEL)
69-
@mkdir -p sdk/docs/api
70-
$(DOCKER_RUN_ROOT) sh -c "cd sdk && pip install -e . -q 2>/dev/null && pdoc --output-directory /workspace/sdk/docs/api --no-show-source --docformat google opendecree !opendecree._generated && chown -R $(shell id -u):$(shell id -g) /workspace/sdk/docs/api"
71-
@echo "Generated API docs in sdk/docs/api/"
67+
## docs: Build the mkdocs documentation site (output in site/)
68+
docs:
69+
pip install -q 'mkdocs-material' 'mkdocstrings[python]'
70+
mkdocs build
71+
@echo "Built docs site in site/"
7272

7373
## build: Build sdist + wheel
7474
build: $(TOOLS_SENTINEL)

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ with ConfigClient("localhost:9090", subject="myapp") as client:
5454
```
5555

5656
> **Fork safety:** gRPC channels are not fork-safe. Create `ConfigClient` (and start any watcher)
57-
> *after* forking — not before. See [Fork safety](sdk/docs/watching.md#fork-safety) for details.
57+
> *after* forking — not before. See [Fork safety](https://opendecree.github.io/decree-python/guide/watch/#fork-safety) for details.
5858
5959
## Async
6060

@@ -80,10 +80,13 @@ Runnable examples in the [`examples/`](examples/) directory:
8080

8181
## Documentation
8282

83-
- [Quick Start](sdk/docs/quickstart.md)
84-
- [Configuration](sdk/docs/configuration.md)
85-
- [Watching](sdk/docs/watching.md)
86-
- [Async Usage](sdk/docs/async.md)
83+
Full documentation, including guides and the API reference, is published at
84+
**[opendecree.github.io/decree-python](https://opendecree.github.io/decree-python)**:
85+
86+
- [Connecting](https://opendecree.github.io/decree-python/guide/connect/) — client options (auth, TLS, retry, timeouts, error handling)
87+
- [Watching](https://opendecree.github.io/decree-python/guide/watch/) — live subscriptions and change patterns
88+
- [Async Usage](https://opendecree.github.io/decree-python/guide/async/) — async client and watcher
89+
- [API Reference](https://opendecree.github.io/decree-python/api/) — full auto-generated API docs
8790

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

build/Dockerfile.tools

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ RUN pip install --no-cache-dir \
1111
grpcio>=1.68.0 \
1212
protobuf>=5.29.0 \
1313
googleapis-common-protos>=1.66.0 \
14-
build \
15-
pdoc>=15.0
14+
build
1615

1716
WORKDIR /workspace
Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The SDK provides async equivalents for all sync APIs, built on `grpc.aio`.
55
## AsyncConfigClient
66

77
```python
8-
from opendecree import AsyncConfigClient
8+
from opendecree import AsyncConfigClient, FieldUpdate
99

1010
async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
1111
# Typed gets (same overload pattern as sync)
@@ -18,23 +18,26 @@ async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
1818

1919
# Writes
2020
await client.set("tenant-id", "payments.fee", "0.5%")
21-
await client.set_many("tenant-id", {"a": "1", "b": "2"})
21+
await client.set_many(
22+
"tenant-id",
23+
[FieldUpdate("a", "1"), FieldUpdate("b", "2")],
24+
description="batch update",
25+
)
2226
await client.set_null("tenant-id", "payments.fee")
2327
```
2428

25-
Same constructor options as `ConfigClient` — see [Configuration](configuration.md).
29+
Same constructor options as `ConfigClient` — see [Connecting](connect.md).
2630

2731
## AsyncConfigWatcher
2832

2933
```python
3034
from opendecree import AsyncConfigClient
3135

3236
async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
33-
watcher = client.watch("tenant-id")
34-
fee = watcher.field("payments.fee", float, default=0.01)
35-
enabled = watcher.field("payments.enabled", bool, default=False)
37+
async with client.watch("tenant-id") as watcher:
38+
fee = watcher.field("payments.fee", float, default=0.01)
39+
enabled = watcher.field("payments.enabled", bool, default=False)
3640

37-
async with watcher:
3841
# .value works the same
3942
print(fee.value)
4043

@@ -48,12 +51,12 @@ async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
4851
Use `async for` instead of `for`:
4952

5053
```python
51-
watcher = client.watch("tenant-id")
52-
fee = watcher.field("payments.fee", float, default=0.01)
54+
async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
55+
async with client.watch("tenant-id") as watcher:
56+
fee = watcher.field("payments.fee", float, default=0.01)
5357

54-
async with watcher:
55-
async for change in fee.changes():
56-
print(f"{change.old_value} -> {change.new_value}")
58+
async for change in fee.changes():
59+
print(f"{change.old_value} -> {change.new_value}")
5760
```
5861

5962
### Callbacks
@@ -83,11 +86,18 @@ The public API is otherwise identical — same constructor options, same `get()`
8386
## When to use async
8487

8588
Use the async API when:
89+
8690
- Your application already uses asyncio (FastAPI, aiohttp, etc.)
8791
- You need to manage many concurrent connections efficiently
8892

8993
Use the sync API when:
94+
9095
- Your application is synchronous (Flask, Django, scripts)
9196
- Simplicity matters more than concurrency
9297

9398
Both APIs are equally capable and tested.
99+
100+
## Next steps
101+
102+
- [Connecting](connect.md) — client options (auth, TLS, retry, error handling)
103+
- [Watching](watch.md) — live subscriptions and change patterns

docs/guide/watch.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
130130

131131
Callbacks work the same as the sync watcher — they are plain functions, not coroutines.
132132

133+
See [Async Usage](async.md) for the full async client and watcher API.
134+
133135
## Fork safety
134136

135137
gRPC channels are **not fork-safe**. Do not create a `ConfigClient` before calling `os.fork()`.

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Runnable examples are available in the [`examples/`](https://github.com/opendecr
8282

8383
- [Connecting](guide/connect.md) — all client options (auth, TLS, retry, timeouts)
8484
- [Watching](guide/watch.md) — live subscriptions and change patterns
85+
- [Async Usage](guide/async.md) — async client and watcher
8586
- [API Reference](api/index.md) — full auto-generated API docs
8687

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

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ nav:
4646
- Guide:
4747
- Connecting: guide/connect.md
4848
- Watching: guide/watch.md
49+
- Async Usage: guide/async.md
4950
- API Reference: api/index.md
5051

5152
markdown_extensions:

sdk/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ async with AsyncConfigClient("localhost:9090", subject="myapp") as client:
6161

6262
## Documentation
6363

64-
- [Quick Start](docs/quickstart.md)
65-
- [Configuration](docs/configuration.md)
66-
- [Watching](docs/watching.md)
67-
- [Async Usage](docs/async.md)
64+
Full documentation, including guides and the API reference, is published at
65+
**[opendecree.github.io/decree-python](https://opendecree.github.io/decree-python)**:
66+
67+
- [Connecting](https://opendecree.github.io/decree-python/guide/connect/) — client options (auth, TLS, retry, timeouts, error handling)
68+
- [Watching](https://opendecree.github.io/decree-python/guide/watch/) — live subscriptions and change patterns
69+
- [Async Usage](https://opendecree.github.io/decree-python/guide/async/) — async client and watcher
70+
- [API Reference](https://opendecree.github.io/decree-python/api/) — full auto-generated API docs
6871

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

0 commit comments

Comments
 (0)