Minimal graph context initializer.
Project description
chalk-fancy
Minimal Python module that provides a "graph context" initializer.
Install (editable)
python -m pip install -e .
Usage
Load ctx user id from parent project .env
In your parent project .env:
CTX_USER_ID=alice
Then:
from chalk_fancy import init_graph_ctx, get_graph_ctx
init_graph_ctx(graph={"id": "g1"})
ctx = get_graph_ctx(require=True)
assert ctx.meta["ctx_user_id"] == "alice"
Scoped context (auto-reset)
from chalk_fancy import sync_graph_context, get_graph_ctx
with sync_graph_context():
ctx = get_graph_ctx(require=True)
assert ctx.meta["ctx_user_id"] == "alice"
Create ctx via API (async)
Register your project's request once:
from chalk_fancy import set_requester, graph_context, get_graph_ctx
set_requester(request) # your project's async request(method, path, json)
async with graph_context():
ctx = get_graph_ctx(require=True)
print(ctx.meta["ctx_user_id"])
# ctx.meta["ctx_id"] is always None (response is not inspected)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chalk_fancy-0.0.3.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chalk_fancy-0.0.3.tar.gz.
File metadata
- Download URL: chalk_fancy-0.0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64c9ade72c5667d5dca7321f4058f17705b03a5c250c23a1a837f10ad0a51a7e
|
|
| MD5 |
77eb7822d5507aaaef964c7832ca5052
|
|
| BLAKE2b-256 |
1b0b037c1b2a06f43dd152fdf1511cc30500755f990927bac9a31bba7318041a
|
File details
Details for the file chalk_fancy-0.0.3-py3-none-any.whl.
File metadata
- Download URL: chalk_fancy-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aa7c3b13030e5a7bf515d884cba832768bd6dbcd834766c10100fc4221662aa
|
|
| MD5 |
9a77f4ffdc0f48e9a6735c975c1c911c
|
|
| BLAKE2b-256 |
1391a8762826b082e5d4676a58260327dd46b07ca8aa70706fd30d88f6b36cce
|