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.0.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.0.tar.gz.
File metadata
- Download URL: chalk_fancy-0.0.0.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 |
f765210e9a8fe5db06520e6b512fb116893515802bc59c7fb406452e78bb226d
|
|
| MD5 |
53e8e277cf34cb2868126ec91daf7725
|
|
| BLAKE2b-256 |
2593620a889b14aafeaa1fdb46da0cfb4499bbaf2a3d9cefdaeb118b30314542
|
File details
Details for the file chalk_fancy-0.0.0-py3-none-any.whl.
File metadata
- Download URL: chalk_fancy-0.0.0-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 |
adce4961aa2e2fd1fe279247ba60d0ee5423b910e1d5caaad09cd6c4d323a462
|
|
| MD5 |
c047b807c4771d33597dc61911f0a9ca
|
|
| BLAKE2b-256 |
584d706dfe4ae84a6a1fc0d6d61eb23da22d1ea1a123c518d0e15edf84f2d10e
|