jellycell.run.context¶
Per-cell :class:RunContext delivered via ContextVar.
Spec §2.4: the runner sets this before each cell executes; :mod:jellycell.api
reads it to decide between “inside a run” and “standalone” behavior.
For subprocess kernels, this ContextVar lives in the kernel’s Python process (the runner installs a setup prelude that imports this module and calls
- func:
set_context). The runner’s own ContextVar tracks its side-of-the-wire state separately.
Module Contents¶
Classes¶
State available to :mod: |
Functions¶
Return the current :class: |
|
Install |
|
Restore the previous context via the token from :func: |
API¶
- class jellycell.run.context.RunContext¶
State available to :mod:
jellycell.apiduring a cell execution.- project: jellycell.paths.Project¶
None
The active :class:
~jellycell.paths.Project.
- jellycell.run.context.get_context() jellycell.run.context.RunContext | None¶
Return the current :class:
RunContextorNoneif outside a run.
- jellycell.run.context.set_context(ctx: jellycell.run.context.RunContext | None) contextvars.Token[jellycell.run.context.RunContext | None]¶
Install
ctxas the current :class:RunContext. Returns the reset token.
- jellycell.run.context.reset_context(token: contextvars.Token[jellycell.run.context.RunContext | None]) None¶
Restore the previous context via the token from :func:
set_context.