PyRuntime#

class tierkreis.pyruntime.python_runtime.PyRuntime(roots: Iterable[Namespace], num_workers: int = 1)[source]#

Bases: RuntimeClient

A simplified python-only Tierkreis runtime. Can be used with builtin operations and python only namespaces that are locally available.

Methods

callback

If a callback function is set, call it with an edge and the value on the edge.

get_signature

Get the signature of functions available on the runtime.

run_graph

Run a tierkreis graph using the python runtime, and provided inputs.

set_callback

Set a callback function that takes a TierkreisEdge and TierkreisValue, which will be called every time a edge receives an output.

type_check_graph

Type check a tierkreis graph on the runtime against the runtime signature.

type_check_graph_with_inputs

Attributes

can_type_check

Whether the runtime supports type-checking graphs.

callback(edge: TierkreisEdge, val: TierkreisValue)[source]#

If a callback function is set, call it with an edge and the value on the edge.

property can_type_check: bool#

Whether the runtime supports type-checking graphs.

async get_signature() Signature[source]#

Get the signature of functions available on the runtime.

async run_graph(run_g: TierkreisGraph, /, **py_inputs: Any) dict[str, TierkreisValue][source]#

Run a tierkreis graph using the python runtime, and provided inputs. Returns the outputs of the graph.

set_callback(callback: Callable[[TierkreisEdge, TierkreisValue], None] | None)[source]#

Set a callback function that takes a TierkreisEdge and TierkreisValue, which will be called every time a edge receives an output. Can be used to inspect intermediate values.

async type_check_graph(graph: TierkreisGraph) TierkreisGraph[source]#

Type check a tierkreis graph on the runtime against the runtime signature.