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-1.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-1.0.3.tar.gz.
File metadata
- Download URL: chalk_fancy-1.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 |
110c22895941a0b9257b5ba78423c987d3f9b781e8e9e624a1e6cac304b9c96d
|
|
| MD5 |
fbb9e7f450d106435f4dd19979f1015e
|
|
| BLAKE2b-256 |
6d6b9044fe3d24dfc8ae766e1f68f1fdce342c1cc32fc27a7d97df99a5a267ee
|
File details
Details for the file chalk_fancy-1.0.3-py3-none-any.whl.
File metadata
- Download URL: chalk_fancy-1.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 |
2724109b04c5c466cbe1cddce9df1d6b9eeb769a21d42d09627dbbac810150ea
|
|
| MD5 |
3472f65f3882c2e3f4dd18adff400127
|
|
| BLAKE2b-256 |
c3c5e6866f1b522cdb0e1a5f507bd93437f382303af658784974a42e9581c501
|