Skip to main content

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)

By default, the module calls https://ctx-graphics.vercel.app/api/ctx. Override with:

CHALK_FANCY_SERVER_URL=https://your-server

Project details


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.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chalk_fancy-1.0.5-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file chalk_fancy-1.0.5.tar.gz.

File metadata

  • Download URL: chalk_fancy-1.0.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for chalk_fancy-1.0.5.tar.gz
Algorithm Hash digest
SHA256 4dd7e1f4f8b5b4215459d153958defe7429434f29b2af64ab4b79218bd7a43bc
MD5 4fc430796f90be4193d798fbe1177746
BLAKE2b-256 7bceec87020b1a6cfd0d7446c70338c79aa9fa008454618d160d82884b51747c

See more details on using hashes here.

File details

Details for the file chalk_fancy-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: chalk_fancy-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for chalk_fancy-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d83cc7eb200ee4d7e25994239ee137c03fec8fa192b8bbb1ad34a846f0a6b45e
MD5 f3d38580a47ed22039ab4baf46a8ceab
BLAKE2b-256 43fb254d8bc7ef9f64d27ce5db8b66e007a142974a6dfe0a5223b872bcf86f22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page