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.4.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.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chalk_fancy-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 05e22bde54d3b0e157f1baf7e6971b87a2680e5b5f4fd6c2fb07ef97a03f230d
MD5 87c4a1cb7aa1f81674056bddb9b3b047
BLAKE2b-256 d1763079a5df037c6659f25540afdf5c311beae4d21112c5fb980c7faf788205

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chalk_fancy-1.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7f2b412d90f957cfe6c4069e650e473cbe0e082b86b010d01934756b8623b089
MD5 d831a3e029d10509c47f33a80fa419d6
BLAKE2b-256 d7357d2b296b6551e8db53edd857b12ff7dcbac3320f10c1a8d1e81dd7f22ab6

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