dr-graph
| Terms and contracts | Terms TOML | Contracts TOML | dr-serialize |
|---|
dr-graph represents hashable computation graphs as data and interprets them deterministically. Graph structure is separate from caller-supplied node behavior.
- Definitions describe reusable graph topology, node fields, dependencies, and variable requirements.
- Configuration models concrete variable values and validates the resulting graph.
- Identity gives every complete graph configuration a stable, versioned identity.
- Execution interprets a graph in topological order while delegating node behavior to the caller.
- Results models per-node and graph-level outcomes, including reuse of completed node outputs when continuing execution.
- Infra
The following sketches show the public contract shapes. Validation and implementation details are omitted.
Definitions
Definitions describe reusable graph topology before concrete variable values are supplied. Materialization binds those values and produces an executable graph configuration.
class NodeDefinition(BaseModel):
node_id: str
node_type: str
fields: tuple[NodeFieldSpec, ...]
input_sources: dict[str, NodeInputSourceRef]
output_field: str
variable_names: frozenset[str]
class GraphDefinition(BaseModel):
schema_version: Literal[1] = 1
nodes: tuple[NodeDefinition, ...]
terminal_node_id: str
def materialize(
self,
variable_assignments: Mapping[str, Mapping[str, Any]] | None = None,
) -> GraphConfig: ...
Configuration
Configurations are complete, validated graphs with concrete values. Their dependency structure has a deterministic topological order.
class NodeConfig(BaseModel):
node_id: str
node_type: str
fields: tuple[NodeFieldSpec, ...]
input_sources: dict[str, NodeInputSourceRef]
output_field: str
variables: dict[str, Any]
class GraphConfig(BaseModel):
nodes: tuple[NodeConfig, ...]
terminal_node_id: str
def topological_order(self) -> tuple[NodeConfig, ...]: ...
def validate_graph_external_inputs(
graph: GraphConfig,
*,
allowed_fields: Collection[str],
) -> None: ...
Identity
Every static configuration field participates in a versioned canonical
identity document. dr-serialize turns that document into the graph's full
SHA-256 hash.
GRAPH_CONFIG_IDENTITY_SCHEMA = "dr_graph.graph_config"
GRAPH_CONFIG_IDENTITY_SCHEMA_VERSION = 1
def graph_config_identity_document(
graph: GraphConfig,
) -> IdentityDocument: ...
def graph_hash(graph: GraphConfig) -> str: ...
Execution
Execution owns graph traversal and dependency wiring while the caller owns node behavior. A dependency-closed set of completed node outputs may be supplied to continue execution.
type RunNode = Callable[
[NodeConfig, Mapping[str, Any]],
NodeOutput | Mapping[str, Any],
]
def execute_graph(
*,
graph: GraphConfig,
inputs: Mapping[str, Any],
run_node: RunNode,
completed: Mapping[str, NodeOutput | Mapping[str, Any]] | None = None,
) -> GraphRunResult: ...
Results
Results distinguish node outcomes from the aggregate graph outcome and retain enough structured state to inspect or continue a run.
class NodeOutcomeStatus(StrEnum):
SUCCESS = "success"
ERROR = "error"
BLOCKED = "blocked"
class GraphRunStatus(StrEnum):
SUCCESS = "success"
ERROR = "error"
BLOCKED = "blocked"
class NodeOutput(BaseModel):
values: dict[str, Jsonable]
metadata: dict[str, Jsonable]
class NodeOutcome(BaseModel):
node_id: str
status: NodeOutcomeStatus
output: NodeOutput | None
error: NodeError | None
blocked_by: tuple[str, ...]
class GraphRunResult(BaseModel):
graph_hash: str
external_inputs: dict[str, Jsonable]
status: GraphRunStatus
outcomes: dict[str, NodeOutcome]
execution_order: tuple[str, ...]
terminal_node_id: str
terminal_output: Jsonable
terminal_error: TerminalError | None
attempt_evidence_refs: tuple[str, ...]
provenance: dict[str, Jsonable]
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dr_graph-0.1.1.tar.gz.
File metadata
- Download URL: dr_graph-0.1.1.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed7d3bee051678373b7d01e0357828aeb37fd856cb9ebf44d9be7cc3cb041635
|
|
| MD5 |
393d5e9a291832e0a744a15a35d70b64
|
|
| BLAKE2b-256 |
8a54e86c0eedeb4d0320fc1f88828a092501d79189c99df4d3904679d8248658
|
Provenance
The following attestation bundles were made for dr_graph-0.1.1.tar.gz:
Publisher:
release.yml on danielle-rothermel/dr-graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dr_graph-0.1.1.tar.gz -
Subject digest:
ed7d3bee051678373b7d01e0357828aeb37fd856cb9ebf44d9be7cc3cb041635 - Sigstore transparency entry: 2350444475
- Sigstore integration time:
-
Permalink:
danielle-rothermel/dr-graph@b3fc3cf049958e802e9a0fc4ff21e3936fc4e735 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/danielle-rothermel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b3fc3cf049958e802e9a0fc4ff21e3936fc4e735 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dr_graph-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dr_graph-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ade261762e3091397c1c9a4f8b6ce578f25184af484b2c0a3d8a8eebfa551e6f
|
|
| MD5 |
f424ac098587b29ee4f821bafc697bcc
|
|
| BLAKE2b-256 |
25abf7db2a3dabb41f5018c26e7290f7d763ee133c24559a1bbe1caf54753b6b
|
Provenance
The following attestation bundles were made for dr_graph-0.1.1-py3-none-any.whl:
Publisher:
release.yml on danielle-rothermel/dr-graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dr_graph-0.1.1-py3-none-any.whl -
Subject digest:
ade261762e3091397c1c9a4f8b6ce578f25184af484b2c0a3d8a8eebfa551e6f - Sigstore transparency entry: 2350444550
- Sigstore integration time:
-
Permalink:
danielle-rothermel/dr-graph@b3fc3cf049958e802e9a0fc4ff21e3936fc4e735 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/danielle-rothermel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b3fc3cf049958e802e9a0fc4ff21e3936fc4e735 -
Trigger Event:
push
-
Statement type: