File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
7494Generate TypedDict types from your Replane dashboard for full type safety:
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Python SDK for [Replane](https://replane.dev) - a dynamic configuration platform
1616``` python
1717from replane import Replane
1818
19+ # Using context manager (recommended)
1920with 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:
Original file line number Diff line number Diff line change @@ -64,6 +64,27 @@ asyncio.run(main())
6464The 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
6990Configs in Replane can be any JSON-serializable value:
You can’t perform that action at this time.
0 commit comments