streamlit-node-editor 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit_node_editor/__init__.py +120 -0
- streamlit_node_editor/frontend/build/asset-manifest.json +10 -0
- streamlit_node_editor/frontend/build/index.html +1 -0
- streamlit_node_editor/frontend/build/static/js/main.9884c600.js +3 -0
- streamlit_node_editor/frontend/build/static/js/main.9884c600.js.LICENSE.txt +63 -0
- streamlit_node_editor/frontend/build/static/js/main.9884c600.js.map +1 -0
- streamlit_node_editor-0.1.0.dist-info/METADATA +217 -0
- streamlit_node_editor-0.1.0.dist-info/RECORD +11 -0
- streamlit_node_editor-0.1.0.dist-info/WHEEL +5 -0
- streamlit_node_editor-0.1.0.dist-info/licenses/LICENSE +21 -0
- streamlit_node_editor-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: streamlit-node-editor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A ComfyUI/Blueprints-style node graph editor for Streamlit — typed ports, drag-to-connect, inline params
|
|
5
|
+
Home-page: https://github.com/RhythrosaLabs/streamlit-node-editor
|
|
6
|
+
Author: Your Name
|
|
7
|
+
Author-email: you@example.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: streamlit>=1.28.0
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# streamlit-node-editor
|
|
27
|
+
|
|
28
|
+
A ComfyUI / Unreal Blueprints-style node graph editor for Streamlit. Define typed node types in Python, let users build graphs by dragging ports and connecting nodes, and get the full graph state back as structured JSON.
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- **Typed ports** with color-coded data types — only compatible types can connect
|
|
35
|
+
- **Drag-to-wire** — click an output port, drag, drop on a compatible input to create a connection
|
|
36
|
+
- **Type validation** — incompatible connections are silently rejected
|
|
37
|
+
- **Inline node parameters** — select dropdowns, number inputs, text inputs, and textareas inside each node
|
|
38
|
+
- **Node palette** — searchable list of all available node types; right-click canvas or use toolbar button
|
|
39
|
+
- **Click wire to delete** — no menu needed
|
|
40
|
+
- **Delete / Backspace** removes the selected node and all its connections
|
|
41
|
+
- **Collapse nodes** to save canvas space
|
|
42
|
+
- **Pan + scroll-to-zoom** with proper SVG coordinate transform
|
|
43
|
+
- **Animated dot-grid background**
|
|
44
|
+
- Zero runtime dependencies beyond Streamlit (no React Flow, no external graph lib)
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install streamlit-node-editor
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quickstart — data pipeline builder
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import streamlit as st
|
|
56
|
+
from streamlit_node_editor import st_node_editor
|
|
57
|
+
|
|
58
|
+
NODE_DEFS = {
|
|
59
|
+
"CSV Source": {
|
|
60
|
+
"category": "Sources",
|
|
61
|
+
"headerColor": "#4ade80",
|
|
62
|
+
"inputs": [],
|
|
63
|
+
"outputs": [{"name": "dataframe", "type": "DATAFRAME"}],
|
|
64
|
+
"params": [
|
|
65
|
+
{"key": "path", "label": "File path", "type": "string", "default": "data.csv"},
|
|
66
|
+
{"key": "sep", "label": "Separator", "type": "string", "default": ","},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
"Filter Rows": {
|
|
70
|
+
"category": "Transform",
|
|
71
|
+
"headerColor": "#38bdf8",
|
|
72
|
+
"inputs": [{"name": "df_in", "type": "DATAFRAME"}],
|
|
73
|
+
"outputs": [{"name": "df_out", "type": "DATAFRAME"}],
|
|
74
|
+
"params": [
|
|
75
|
+
{"key": "query", "label": "Query expr", "type": "string",
|
|
76
|
+
"default": "value > 0"},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
"Group By": {
|
|
80
|
+
"category": "Transform",
|
|
81
|
+
"headerColor": "#818cf8",
|
|
82
|
+
"inputs": [{"name": "df_in", "type": "DATAFRAME"}],
|
|
83
|
+
"outputs": [{"name": "df_out", "type": "DATAFRAME"}],
|
|
84
|
+
"params": [
|
|
85
|
+
{"key": "column", "label": "Column", "type": "string"},
|
|
86
|
+
{"key": "agg", "label": "Aggregate","type": "select",
|
|
87
|
+
"options": ["sum", "mean", "count", "min", "max"]},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
"Bar Chart": {
|
|
91
|
+
"category": "Outputs",
|
|
92
|
+
"headerColor": "#fb923c",
|
|
93
|
+
"inputs": [{"name": "dataframe", "type": "DATAFRAME"}],
|
|
94
|
+
"outputs": [],
|
|
95
|
+
"params": [
|
|
96
|
+
{"key": "x", "label": "X column", "type": "string"},
|
|
97
|
+
{"key": "y", "label": "Y column", "type": "string"},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
graph = st_node_editor(NODE_DEFS, height=600, key="pipeline")
|
|
103
|
+
|
|
104
|
+
if graph:
|
|
105
|
+
st.subheader("Graph state")
|
|
106
|
+
st.json(graph)
|
|
107
|
+
|
|
108
|
+
# Execute the pipeline
|
|
109
|
+
if st.button("Run pipeline"):
|
|
110
|
+
import pandas as pd
|
|
111
|
+
# Walk graph["connections"] in topological order and execute each node
|
|
112
|
+
# based on graph["nodes"][i]["type"] and graph["nodes"][i]["params"]
|
|
113
|
+
st.info("Pipeline execution logic goes here")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## API
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
st_node_editor(node_defs, initial_nodes=None, initial_connections=None, height=700, key=None)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Parameter | Type | Default | Description |
|
|
123
|
+
|-----------|------|---------|-------------|
|
|
124
|
+
| `node_defs` | `dict[str, dict]` | required | Node type registry |
|
|
125
|
+
| `initial_nodes` | `list[dict]` | `[]` | Pre-placed nodes |
|
|
126
|
+
| `initial_connections` | `list[dict]` | `[]` | Pre-existing wires |
|
|
127
|
+
| `height` | `int` | `700` | Canvas height in pixels |
|
|
128
|
+
| `key` | `str` | `None` | Streamlit widget key |
|
|
129
|
+
|
|
130
|
+
### Node definition schema
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
"Node Type Name": {
|
|
134
|
+
"category": str, # palette grouping
|
|
135
|
+
"headerColor": str, # hex color for the node's title bar
|
|
136
|
+
"inputs": [
|
|
137
|
+
{"name": str, "type": str} # type key must match a registered port type
|
|
138
|
+
],
|
|
139
|
+
"outputs": [
|
|
140
|
+
{"name": str, "type": str}
|
|
141
|
+
],
|
|
142
|
+
"params": [
|
|
143
|
+
{
|
|
144
|
+
"key": str,
|
|
145
|
+
"label": str,
|
|
146
|
+
"type": str, # "int" | "float" | "string" | "select" | "textarea"
|
|
147
|
+
"default": any, # optional
|
|
148
|
+
"options": list[str], # required when type == "select"
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Built-in port types
|
|
155
|
+
|
|
156
|
+
| Type | Color | Typical use |
|
|
157
|
+
|------|-------|-------------|
|
|
158
|
+
| `IMAGE` | green | Pixel data |
|
|
159
|
+
| `LATENT` | purple | Latent tensors |
|
|
160
|
+
| `MODEL` | orange | Neural network weights |
|
|
161
|
+
| `CLIP` | yellow | Text encoders |
|
|
162
|
+
| `VAE` | red | Variational autoencoders |
|
|
163
|
+
| `INT` | blue | Integer values |
|
|
164
|
+
| `FLOAT` | indigo | Float values |
|
|
165
|
+
| `STRING` | stone | Text |
|
|
166
|
+
| `MASK` | teal | Binary masks |
|
|
167
|
+
| `ANY` | gray | Accepts any type |
|
|
168
|
+
|
|
169
|
+
Define your own types freely in `node_defs` — any unrecognized type string uses the `ANY` gray color.
|
|
170
|
+
|
|
171
|
+
### Return value
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
{
|
|
175
|
+
"nodes": [
|
|
176
|
+
{
|
|
177
|
+
"id": str,
|
|
178
|
+
"type": str,
|
|
179
|
+
"x": float,
|
|
180
|
+
"y": float,
|
|
181
|
+
"params": {key: value, ...}
|
|
182
|
+
},
|
|
183
|
+
...
|
|
184
|
+
],
|
|
185
|
+
"connections": [
|
|
186
|
+
{
|
|
187
|
+
"id": str,
|
|
188
|
+
"fromNode": str, # node id
|
|
189
|
+
"fromPort": int, # output port index
|
|
190
|
+
"toNode": str, # node id
|
|
191
|
+
"toPort": int, # input port index
|
|
192
|
+
},
|
|
193
|
+
...
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
git clone https://github.com/RhythrosaLabs/streamlit-node-editor
|
|
202
|
+
cd streamlit-node-editor
|
|
203
|
+
|
|
204
|
+
cd streamlit_node_editor/frontend
|
|
205
|
+
npm install
|
|
206
|
+
npm start # dev server on :3004
|
|
207
|
+
|
|
208
|
+
# separate terminal
|
|
209
|
+
cd ../..
|
|
210
|
+
pip install -e .
|
|
211
|
+
# Set _RELEASE = False in streamlit_node_editor/__init__.py
|
|
212
|
+
streamlit run example.py
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
MIT
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
streamlit_node_editor/__init__.py,sha256=R0ALgkUz2F3CzgaX4ji_eG22lGEygCfvHdjo4C5y0dU,4015
|
|
2
|
+
streamlit_node_editor/frontend/build/asset-manifest.json,sha256=xP9fAudVwyLtTUwcftnKTjoDm1lwZgHMYaN2pmMJX7Y,221
|
|
3
|
+
streamlit_node_editor/frontend/build/index.html,sha256=pAH0G2hhajsH4GQ5wDYVycJzXUWs5ytegzDvcu7yKA4,345
|
|
4
|
+
streamlit_node_editor/frontend/build/static/js/main.9884c600.js,sha256=AbJg0yKFpSe_7fPjPCqN5b2ZILZL88P_0pHXouROcXg,347457
|
|
5
|
+
streamlit_node_editor/frontend/build/static/js/main.9884c600.js.LICENSE.txt,sha256=BPbCZITzGALY9iYhI40O6qpneJKw2CdM7mGhDk6ejfI,1514
|
|
6
|
+
streamlit_node_editor/frontend/build/static/js/main.9884c600.js.map,sha256=4k3fDzmUc6YFBwLIMaBnJUHFqYl3ynQsiEST7Hp5-Ao,1347576
|
|
7
|
+
streamlit_node_editor-0.1.0.dist-info/licenses/LICENSE,sha256=OphKV48tcMv6ep-7j-8T6nycykPT0g8ZlMJ9zbGvdPs,1066
|
|
8
|
+
streamlit_node_editor-0.1.0.dist-info/METADATA,sha256=CfK4BCckwGx1rLvZdATeoK2mzpusuzj13GnXhrCQXFY,6744
|
|
9
|
+
streamlit_node_editor-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
10
|
+
streamlit_node_editor-0.1.0.dist-info/top_level.txt,sha256=6UYPtVV9utlhynONE2RH4Fq3hoqT6l0UCycAJfkclsg,22
|
|
11
|
+
streamlit_node_editor-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Your Name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
streamlit_node_editor
|