{ "module": "dagpipe.node", "content": { "path": "dagpipe.node", "docstring": "# Summary\n\nDefines the `Node` abstraction used by `dagpipe`.\n\nA node represents a single unit of pipeline execution logic. It consumes one\n`State` and produces zero, one, or many new `State` objects.\n\nNodes are connected using a `Graph` and executed by an `Engine`.\n\n---\n\n# Design principles\n\n- **Pure:** Must not mutate input state.\n- **Deterministic:** Same input produces same output.\n- **Stateless:** Recommended to be stateless for reuse.\n- **Composable:** Nodes enable branching execution graphs.", "objects": { "inspect": { "name": "inspect", "kind": "alias", "path": "dagpipe.node.inspect", "signature": "", "docstring": null }, "re": { "name": "re", "kind": "alias", "path": "dagpipe.node.re", "signature": "", "docstring": null }, "ABC": { "name": "ABC", "kind": "alias", "path": "dagpipe.node.ABC", "signature": "", "docstring": null }, "abstractmethod": { "name": "abstractmethod", "kind": "alias", "path": "dagpipe.node.abstractmethod", "signature": "", "docstring": null }, "Iterable": { "name": "Iterable", "kind": "alias", "path": "dagpipe.node.Iterable", "signature": "", "docstring": null }, "Iterator": { "name": "Iterator", "kind": "alias", "path": "dagpipe.node.Iterator", "signature": "", "docstring": null }, "Any": { "name": "Any", "kind": "alias", "path": "dagpipe.node.Any", "signature": "", "docstring": null }, "cast": { "name": "cast", "kind": "alias", "path": "dagpipe.node.cast", "signature": "", "docstring": null }, "State": { "name": "State", "kind": "class", "path": "dagpipe.node.State", "signature": "", "docstring": "Immutable execution state propagated through dagpipe pipeline.\n\nAttributes:\n payload (Payload):\n Execution data container.\n\n schema (ClassVar[Schema]):\n Payload validation schema.\n\n confidence (float):\n Execution confidence score.\n\n parent (Optional[State]):\n Parent state reference.\n\n depth (int):\n Execution depth.\n\n history (Tuple[str, ...]):\n Ordered node execution lineage.\n\n metadata (Dict[str, Any]):\n Execution metadata.\n\nNotes:\n **Responsibilities:**\n\n - Represents a complete execution snapshot at a specific point in\n pipeline traversal.\n - Fundamental unit of execution in `dagpipe`.\n - Fully thread-safe due to immutability.", "members": { "payload": { "name": "payload", "kind": "attribute", "path": "dagpipe.node.State.payload", "signature": "", "docstring": null }, "schema": { "name": "schema", "kind": "attribute", "path": "dagpipe.node.State.schema", "signature": "", "docstring": null }, "confidence": { "name": "confidence", "kind": "attribute", "path": "dagpipe.node.State.confidence", "signature": "", "docstring": null }, "parent": { "name": "parent", "kind": "attribute", "path": "dagpipe.node.State.parent", "signature": "", "docstring": null }, "depth": { "name": "depth", "kind": "attribute", "path": "dagpipe.node.State.depth", "signature": "", "docstring": null }, "history": { "name": "history", "kind": "attribute", "path": "dagpipe.node.State.history", "signature": "", "docstring": null }, "metadata": { "name": "metadata", "kind": "attribute", "path": "dagpipe.node.State.metadata", "signature": "", "docstring": null }, "fork": { "name": "fork", "kind": "function", "path": "dagpipe.node.State.fork", "signature": "", "docstring": "Create a new child `State` derived from this state.\n\nArgs:\n payload_update (Mapping[str, Any], optional):\n Dot-path updates applied to the payload.\n\n confidence_delta (float, optional):\n Adjustment applied to current confidence.\n\n node_id (str, optional):\n Identifier of the node creating this state.\n\n metadata_update (Mapping[str, Any], optional):\n Updates merged into state metadata.\n\nReturns:\n State:\n A new immutable `State` instance.\n\nNotes:\n **Guarantees:**\n\n - This is the only supported mechanism for modifying execution data.\n - Validates payload updates, preserves lineage, increments depth,\n and appends to history." }, "lineage": { "name": "lineage", "kind": "function", "path": "dagpipe.node.State.lineage", "signature": "", "docstring": "Return lineage from root to this State.\n\nReturns:\n Tuple[State, ...]:\n Ordered execution lineage (root first)." }, "get": { "name": "get", "kind": "function", "path": "dagpipe.node.State.get", "signature": "", "docstring": "Retrieve payload value.\n\nArgs:\n key (str):\n Dot-path key.\n default (Any, optional):\n Fallback value.\n\nReturns:\n Any:\n Stored value or default." }, "has": { "name": "has", "kind": "function", "path": "dagpipe.node.State.has", "signature": "", "docstring": "Check whether payload contains key.\n\nArgs:\n key (str):\n Dot-path key.\n\nReturns:\n bool:\n Existence of the key." } } }, "Node": { "name": "Node", "kind": "class", "path": "dagpipe.node.Node", "signature": "", "docstring": "Base class for all dagpipe execution nodes.\n\nAttributes:\n id (str):\n Unique identifier of the node (snake_case dotted format).\n\n name (str):\n Human-readable display name.\n\nNotes:\n **Responsibilities:**\n\n - Represents a deterministic unit of execution in the pipeline graph.\n - Consumes one `State` and produces zero, one, or many derived states.\n - Defines execution logic and enables branching, filtering, and transformation.\n\n **Guarantees:**\n\n - Nodes must never mutate the input `State`.\n - Instances are singletons per subclass and reused across executions.", "members": { "id": { "name": "id", "kind": "attribute", "path": "dagpipe.node.Node.id", "signature": null, "docstring": null }, "name": { "name": "name", "kind": "attribute", "path": "dagpipe.node.Node.name", "signature": null, "docstring": null }, "node_id_to_name": { "name": "node_id_to_name", "kind": "function", "path": "dagpipe.node.Node.node_id_to_name", "signature": "", "docstring": "Convert a dotted snake_case node ID into a human-readable name.\n\nArgs:\n node_id (str):\n Unique node identifier (e.g., 'entity.resolve.numeric_merchant').\n\nReturns:\n str:\n Human-readable display name (e.g., 'Entity › Resolve › Numeric Merchant')." }, "clean_id_and_name": { "name": "clean_id_and_name", "kind": "function", "path": "dagpipe.node.Node.clean_id_and_name", "signature": "", "docstring": "Normalize and validate node ID and display name.\n\nRaises:\n TypeError:\n If ID is not a string.\n ValueError:\n If ID format is invalid.\n\nNotes:\n **Guarantees:**\n\n - Generates ID from module and class name if missing.\n - Validates ID format.\n - Generates human-readable name if missing." }, "run": { "name": "run", "kind": "function", "path": "dagpipe.node.Node.run", "signature": "", "docstring": "Execute this node on a `State`.\n\nArgs:\n state (State):\n Input execution state.\n\nReturns:\n tuple[State, ...]:\n Derived execution states.\n\nRaises:\n TypeError:\n If `resolve()` yields a non-`State` object." }, "fork": { "name": "fork", "kind": "function", "path": "dagpipe.node.Node.fork", "signature": "", "docstring": "Create a child `State` attributed to this node.\n\nArgs:\n state (State):\n Parent execution state.\n\n payload_update (Mapping[str, Any], optional):\n Dot-path payload updates.\n\n confidence_delta (float, optional):\n Confidence adjustment.\n\n metadata_update (Mapping[str, Any], optional):\n Metadata updates.\n\nReturns:\n State:\n New child execution state.\n\nNotes:\n **Responsibilities:**\n\n - Convenience wrapper around `State.fork()` that automatically\n records this node's ID in state history." }, "resolve": { "name": "resolve", "kind": "function", "path": "dagpipe.node.Node.resolve", "signature": "", "docstring": "Execute node logic.\n\nArgs:\n state (State):\n Input execution state.\n\nYields:\n State:\n Derived execution state(s).\n\nNotes:\n **Responsibilities:**\n\n - Subclasses implement specific resolution behavior.\n - Must not mutate input state.\n - Should use `fork()` to create child states.\n - May yield zero states to terminate a branch." }, "is_async": { "name": "is_async", "kind": "function", "path": "dagpipe.node.Node.is_async", "signature": "", "docstring": "Return whether this node executes asynchronously." } } }, "AsyncNode": { "name": "AsyncNode", "kind": "class", "path": "dagpipe.node.AsyncNode", "signature": "", "docstring": "Base class for nodes whose execution is asynchronous.\n\nSubclasses implement `resolve_async` (an async generator yielding derived\n`State` objects). The engine dispatches to `resolve_async` when running an\nasync traversal (see `Engine.run_async`).\n\nSync-only engines (and the base `Node.run`) treat an `AsyncNode` as a no-op\nconsumer: calling `run` on an `AsyncNode` returns no states, signalling that\nan async engine is required.", "members": { "resolve": { "name": "resolve", "kind": "function", "path": "dagpipe.node.AsyncNode.resolve", "signature": "", "docstring": null }, "resolve_async": { "name": "resolve_async", "kind": "function", "path": "dagpipe.node.AsyncNode.resolve_async", "signature": "", "docstring": "Execute node logic asynchronously.\n\nArgs:\n state (State):\n Input execution state.\n\nReturns:\n Iterable[State]:\n Derived execution state(s).\n\nNotes:\n Subclasses implement this. Must not mutate the input state.\n Should use `fork()` to create child states." }, "run_async": { "name": "run_async", "kind": "function", "path": "dagpipe.node.AsyncNode.run_async", "signature": "", "docstring": "Execute this node asynchronously on a state, validating outputs." } } }, "abc": { "name": "abc", "kind": "alias", "path": "dagpipe.node.abc", "signature": "", "docstring": null } } } }