No project description provided
Project description
ipydagflow
Interactive DAG (Directed Acyclic Graph) visualization widgets for Jupyter notebooks using React Flow.
Features
- ๐จ Beautiful Interactive Visualizations - Smooth, modern DAG rendering with React Flow
- ๐ง Two APIs - Low-level (DynamicDAG) and high-level (StepDAG) interfaces
- ๐ฏ Automatic Layout - No need to specify positions - nodes are laid out automatically
- ๐จ Customizable Styles - Full control over colors, borders, and appearance
- ๐ Built for Data Pipelines - Perfect for ETL workflows, ML pipelines, and task dependencies
- โ Validation - Automatic cycle detection and DAG validation
- ๐ Interactive - Click nodes to see details, drag to rearrange
Installation
pip install ipydagflow
For development:
git clone https://github.com/yourusername/ipydagflow
cd ipydagflow
pip install -e .
Quick Start
High-Level API (StepDAG)
Build DAGs programmatically using Step objects:
from ipydagflow import StepDAG, Step
# Create steps
extract = Step(id="extract", label="Extract Data", step_type="datasource")
transform = Step(id="transform", label="Transform", step_type="box")
load = Step(id="load", label="Load to DB", step_type="datasource")
# Connect steps
extract.add_child(transform)
transform.add_child(load)
# Create and display DAG
dag = StepDAG()
dag.add_steps(extract, transform, load)
dag.render() # Returns a widget to display in Jupyter
Low-Level API (DynamicDAG)
For direct control over nodes and edges:
from ipydagflow import DynamicDAG
nodes = [
{"id": "1", "type": "datasource", "data": {"label": "Input"}},
{"id": "2", "type": "box", "data": {"label": "Process"}},
{"id": "3", "type": "datasource", "data": {"label": "Output"}},
]
edges = [
{"id": "e1", "source": "1", "target": "2"},
{"id": "e2", "source": "2", "target": "3"},
]
dag = DynamicDAG(nodes=nodes, edges=edges)
dag # Display in Jupyter
Examples
Complex Pipeline
from ipydagflow import StepDAG, Step
# Build a data processing pipeline
raw = Step(id="raw", label="Raw Data", step_type="datasource")
clean = Step(id="clean", label="Clean", step_type="box")
feature_a = Step(id="feat_a", label="Feature A", step_type="box")
feature_b = Step(id="feat_b", label="Feature B", step_type="box")
combine = Step(id="combine", label="Combine", step_type="box")
output = Step(id="output", label="Output", step_type="datasource")
# Connect: raw -> clean -> [feature_a, feature_b] -> combine -> output
raw.add_child(clean)
clean.add_children(feature_a, feature_b)
feature_a.add_child(combine)
feature_b.add_child(combine)
combine.add_child(output)
# Render
dag = StepDAG()
dag.add_steps(raw, clean, feature_a, feature_b, combine, output)
dag.render()
Custom Styling
custom_styles = {
"datasource": {
"background": "rgba(255, 99, 132, 0.8)",
"color": "white",
"borderColor": "#ff6384",
"borderWidth": 3,
},
"box": {
"background": "rgba(54, 162, 235, 0.8)",
"color": "white",
"borderColor": "#36a2eb",
"borderWidth": 2,
},
}
dag = StepDAG(styles=custom_styles)
dag.add_steps(step1, step2, step3)
dag.render()
Adding Metadata
step = Step(
id="process",
label="Calculate Metrics",
step_type="box",
data={
"owner": "data-team",
"schedule": "0 0 * * *",
"retry": 3,
"timeout": "1h"
}
)
# Click the node in the widget to see the metadata!
API Reference
Step
Step(
id: str, # Unique identifier
label: str, # Display label
step_type: str, # Node type: "datasource", "box", or custom
data: dict # Additional metadata
)
Methods:
add_child(step)- Add a child stepadd_children(*steps)- Add multiple childrenadd_parent(step)- Add a parent stepget_all_descendants()- Get all descendant stepsget_all_ancestors()- Get all ancestor steps
StepDAG
StepDAG(styles: dict = None)
Methods:
add_step(step)- Add a stepadd_steps(*steps)- Add multiple stepsget_step(step_id)- Get step by IDget_all_steps()- Get all stepsget_root_steps()- Get steps with no parentsget_leaf_steps()- Get steps with no childrenvalidate()- Validate DAG (returns list of errors)render()- Create and return DynamicDAG widget
DynamicDAG
DynamicDAG(
nodes: list, # List of node dicts
edges: list, # List of edge dicts
styles: dict = None # Custom styling
)
Node format:
{
"id": "unique_id",
"type": "datasource", # or "box"
"data": {"label": "Display Name", ...},
"position": {"x": 100, "y": 100} # Optional - auto-layout if omitted
}
Edge format:
{
"id": "edge_id",
"source": "source_node_id",
"target": "target_node_id",
"animated": True # Optional
}
Development
Setup
# Clone the repo
git clone https://github.com/yourusername/ipydagflow
cd ipydagflow
# Install dependencies
npm install
pip install -e .
# Build JavaScript
npm run build
# Run in dev mode (auto-rebuild on changes)
npm run dev
Project Structure
ipydagflow/
โโโ src/
โ โโโ ipydagflow/
โ โโโ __init__.py # Main exports
โ โโโ widgets/ # Widget classes
โ โ โโโ dynamic_dag.py # Low-level widget
โ โ โโโ step_dag.py # High-level builder
โ โโโ models/ # Data models
โ โ โโโ step.py # Step class
โ โโโ utils/ # Utilities
โ โ โโโ layout.py # Layout algorithms
โ โโโ static/ # Built JS/CSS
โโโ ui/ # TypeScript/React source
โ โโโ dynamic_dag.tsx # React Flow component
โ โโโ dynamic_dag.css # Styles
โโโ examples/ # Example notebooks
License
MIT
Contributing
Contributions welcome! Please open an issue or PR on GitHub.
Project details
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 ipydagflow-0.0.5.tar.gz.
File metadata
- Download URL: ipydagflow-0.0.5.tar.gz
- Upload date:
- Size: 154.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8072f25b0673eeb6467735600dc2bab8b1fed4ad1b172d5bf52eccc767a06b68
|
|
| MD5 |
e938c21fe61fa5929ea77d65fe4b6feb
|
|
| BLAKE2b-256 |
9a1bd08d22d2b37f5aa423f6afa90fc59a7fdb6da5a8c75e84232c8f10193d05
|
Provenance
The following attestation bundles were made for ipydagflow-0.0.5.tar.gz:
Publisher:
publish.yml on Vanessamae23/ipydagflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ipydagflow-0.0.5.tar.gz -
Subject digest:
8072f25b0673eeb6467735600dc2bab8b1fed4ad1b172d5bf52eccc767a06b68 - Sigstore transparency entry: 1182370095
- Sigstore integration time:
-
Permalink:
Vanessamae23/ipydagflow@1e5025d39fb6a8330aa73255e0a31a73777b0ad4 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/Vanessamae23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1e5025d39fb6a8330aa73255e0a31a73777b0ad4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ipydagflow-0.0.5-py3-none-any.whl.
File metadata
- Download URL: ipydagflow-0.0.5-py3-none-any.whl
- Upload date:
- Size: 149.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8712a65bc6a9d15bb17caa6ecf264f1f118c1c6c05a8b53ac34706c77b7a188c
|
|
| MD5 |
9f4b26b90841fdaacbb028452d25a4dd
|
|
| BLAKE2b-256 |
13a75a4ec438bcb1234abf94c7d448fa4ad2e4290bbe1b94687c59ad1687d737
|
Provenance
The following attestation bundles were made for ipydagflow-0.0.5-py3-none-any.whl:
Publisher:
publish.yml on Vanessamae23/ipydagflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ipydagflow-0.0.5-py3-none-any.whl -
Subject digest:
8712a65bc6a9d15bb17caa6ecf264f1f118c1c6c05a8b53ac34706c77b7a188c - Sigstore transparency entry: 1182370115
- Sigstore integration time:
-
Permalink:
Vanessamae23/ipydagflow@1e5025d39fb6a8330aa73255e0a31a73777b0ad4 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/Vanessamae23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1e5025d39fb6a8330aa73255e0a31a73777b0ad4 -
Trigger Event:
release
-
Statement type: