pyiron_workflow.constructors module

pyiron_workflow.constructors.atomictype2node(function: LambdaType | type, label: Annotated[str, BeforeValidator(func=_validate_label, json_schema_input_type=PydanticUndefined)] | None = None, /, **connections: Port | Node | JSONABLE) Atomic | Macro[source]

Convert a function or class into a node labelled label (defaulting to its __name__).

Only a recipe attached to function _itself_ is honoured; an inherited recipe is ignored, so that an undecorated subclass of a decorated class gets parsed afresh instead of silently referencing its parent.

pyiron_workflow.constructors.edgelist2edges(edges: list[EdgeTuple], scope: str = '<unknown EdgeList owner>') tuple[dict[TargetHandle, InputSource], dict[TargetHandle, SourceHandle], dict[OutputTarget, SourceHandle | InputSource]][source]
pyiron_workflow.constructors.edges2edgelist(input_edges: dict[TargetHandle, InputSource], edges: dict[TargetHandle, SourceHandle], output_edges: dict[OutputTarget, SourceHandle | InputSource]) list[EdgeTuple][source]
pyiron_workflow.constructors.macro2workflow(macro: Macro) Workflow[source]
pyiron_workflow.constructors.node(value: Node | AtomicRecipe | ForEachRecipe | IfRecipe | TryRecipe | WhileRecipe | WorkflowRecipe | ConstantRecipe | LambdaType | type | JSONABLE, label: Annotated[str, BeforeValidator(func=_validate_label, json_schema_input_type=PydanticUndefined)] | None = None, /, **connections: Port | Node | JSONABLE) Node[source]

Convert a node-like value into a Node labelled label.

Accepts a Node, an flowrep recipe, a plain function or class, or a JSONable constant. Raises TypeError otherwise.

When the passed object is already a node instance, returns a copy.

Functions and classes will be searched for an attached flowrep recipe, and otherwise parsed as atomic nodes. Un-parseable callables will raise the underlying flowrep error.

pyiron_workflow.constructors.recipe2node(recipe: AtomicRecipe | ForEachRecipe | IfRecipe | TryRecipe | WhileRecipe | WorkflowRecipe | ConstantRecipe, label: Annotated[str, BeforeValidator(func=_validate_label, json_schema_input_type=PydanticUndefined)] | None = None, /, **connections: Port | Node | JSONABLE) StaticNode[source]
pyiron_workflow.constructors.workflow2macro(wf: Workflow) Macro[source]