Skip to content

Commit 3875f56

Browse files
committed
chore: update docs
1 parent 164c87c commit 3875f56

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@ async with AsyncReplane(
6969
enabled = replane.with_context({"plan": "premium"}).configs["feature"]
7070
```
7171

72+
### Without Context Manager
73+
74+
```python
75+
from replane import Replane
76+
77+
replane = Replane(
78+
base_url="https://cloud.replane.dev",
79+
sdk_key="rp_...",
80+
)
81+
replane.connect()
82+
83+
# Use configs
84+
rate_limit = replane.configs["rate-limit"]
85+
user_client = replane.with_context({"user_id": "123"})
86+
feature = user_client.configs["feature-flag"]
87+
88+
# Don't forget to close when done
89+
replane.close()
90+
```
91+
7292
### Type-Safe with Generated Types (Recommended)
7393

7494
Generate TypedDict types from your Replane dashboard for full type safety:

docs/source/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Python SDK for [Replane](https://replane.dev) - a dynamic configuration platform
1616
```python
1717
from replane import Replane
1818

19+
# Using context manager (recommended)
1920
with Replane(
2021
base_url="https://replane.example.com",
2122
sdk_key="rp_...",
@@ -28,6 +29,17 @@ with Replane(
2829
feature_enabled = user_client.configs["new-feature"]
2930
```
3031

32+
Or without context manager:
33+
34+
```python
35+
replane = Replane(base_url="...", sdk_key="...")
36+
replane.connect()
37+
38+
rate_limit = replane.configs["rate-limit"]
39+
40+
replane.close()
41+
```
42+
3143
```{toctree}
3244
:maxdepth: 2
3345
:hidden:

docs/source/quickstart.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,27 @@ asyncio.run(main())
6464
The async client requires the `async` extra: `pip install replane[async]`
6565
```
6666

67+
### Without Context Manager
68+
69+
If you prefer manual lifecycle management:
70+
71+
```python
72+
from replane import Replane
73+
74+
replane = Replane(
75+
base_url="https://replane.example.com",
76+
sdk_key="rp_...",
77+
)
78+
replane.connect()
79+
80+
try:
81+
rate_limit = replane.configs["rate-limit"]
82+
user_client = replane.with_context({"user_id": "123"})
83+
feature = user_client.configs["feature-flag"]
84+
finally:
85+
replane.close()
86+
```
87+
6788
## Understanding Config Values
6889

6990
Configs in Replane can be any JSON-serializable value:

0 commit comments

Comments
 (0)