compiled
compiled
#
@cg.procedure — compile a body function into a procedure graph.
The decorated function records its structure by constructing nodes against the
schema root: navigate on root, cache with |= / &=, add side-effect
steps. There is no global state — a
RootContext
collects the body (run inside a procedure_sequence) and reduces it to one root
ProcedureSequence. GetRoot is built inside that sequence with the target
schema; if the body never navigates it, it is a dropped no-op rather than a
recorded step.
CompiledProcedure
#
A @cg.procedure-decorated function; build it to the node graph + schema.
Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/compiled.py
__init__(schema, fn, name, label)
#
Wrap a recorded body fn with the schema it navigates, its name, and label.
Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/compiled.py
build()
#
Run the body once and return the root ProcedureSequence.
Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/compiled.py
to_dict()
#
The full wire form {schema, root, nodes}.
Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/compiled.py
to_json(indent=4, **json_kwargs)
#
The full wire form as a JSON string.
Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/compiled.py
procedure(schema, *, label=None)
#
Decorate def f(root: cg.Procedure[cg.Path[Schema]]) as a procedure.
The decorated function becomes a [CompiledProcedure][]; call .to_json()
/ .to_dict() / .build() to emit the graph. Inside the body, root is
the GetRoot node rooted at Schema; cache with |= / &= and add
side-effect steps with cg.do(step).
label is the human-readable name shown in the app; it defaults to the
function name, so pass it when that reads poorly (label="Clementine Rating"
beats clementine_rating).