flowrep.compiler.source module

class flowrep.compiler.source.RenderedSource(source: str, namespace: dict[str, Any], function_name: str)[source]

Bases: object

Executable Python source plus the live namespace it must be exec’d against.

build() LambdaType[source]

exec the source against a copy of the namespace and return the function.

dump(path: Path | str, *, parents: bool = True, exists_ok: bool = True, allow_namespace_symbols: bool = False) str[source]

Write self.source to path and return a status message.

A missing extension is filled in as .py; any other extension is rejected. Namespace symbols appear as unbound references in the dumped file, so dumping a non-empty namespace requires opting in.

Raises:
  • ValueError – Non-.py extension, or namespace symbols present without allow_namespace_symbols.

  • FileExistsErrorpath exists and exists_ok is False.

function_name: str
namespace: dict[str, Any]
source: str
flowrep.compiler.source.flowrep2python(workflow: WorkflowRecipe | DagData, function_name: Annotated[str, BeforeValidator(func=_validate_label, json_schema_input_type=PydanticUndefined)] | None = None, signature: Signature | None = None, _workflow_decorator: tuple[str, str] = ('flowrep', 'workflow')) RenderedSource[source]

Compile a workflow recipe into a rendered object that can be built into a function object or dumped to a .py file.