dash-flows 0.0.2__tar.gz
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.
- dash_flows-0.0.2/LICENSE +0 -0
- dash_flows-0.0.2/MANIFEST.in +11 -0
- dash_flows-0.0.2/PKG-INFO +108 -0
- dash_flows-0.0.2/README.md +169 -0
- dash_flows-0.0.2/dash_flow/dash_flow.min.js +3 -0
- dash_flows-0.0.2/dash_flow/dash_flow.min.js.map +1 -0
- dash_flows-0.0.2/dash_flow/metadata.json +1 -0
- dash_flows-0.0.2/dash_flow/package-info.json +64 -0
- dash_flows-0.0.2/dash_flows.egg-info/PKG-INFO +108 -0
- dash_flows-0.0.2/dash_flows.egg-info/SOURCES.txt +14 -0
- dash_flows-0.0.2/dash_flows.egg-info/dependency_links.txt +1 -0
- dash_flows-0.0.2/dash_flows.egg-info/top_level.txt +1 -0
- dash_flows-0.0.2/package.json +64 -0
- dash_flows-0.0.2/setup.cfg +4 -0
- dash_flows-0.0.2/setup.py +26 -0
- dash_flows-0.0.2/tests/test_usage.py +25 -0
dash_flows-0.0.2/LICENSE
ADDED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
include dash_flow/dash_flow.min.js
|
|
2
|
+
include dash_flow/dash_flow.min.js.map
|
|
3
|
+
include dash_flow/async-*.js
|
|
4
|
+
include dash_flow/async-*.js.map
|
|
5
|
+
include dash_flow/*-shared.js
|
|
6
|
+
include dash_flow/*-shared.js.map
|
|
7
|
+
include dash_flow/metadata.json
|
|
8
|
+
include dash_flow/package-info.json
|
|
9
|
+
include README.md
|
|
10
|
+
include LICENSE
|
|
11
|
+
include package.json
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dash_flows
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A Dash component library for creating interactive node-based interfaces with React Flow
|
|
5
|
+
Author: Pip Install Python <pipinstallpython@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Framework :: Dash
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
|
|
11
|
+
# Dash Flow
|
|
12
|
+
|
|
13
|
+
Dash Flow is a Dash component library.
|
|
14
|
+
|
|
15
|
+
A Dash component library for creating interactive node-based interfaces with React Flow
|
|
16
|
+
|
|
17
|
+
Get started with:
|
|
18
|
+
1. Install Dash and its dependencies: https://dash.plotly.com/installation
|
|
19
|
+
2. Run `python usage.py`
|
|
20
|
+
3. Visit http://localhost:8050 in your web browser
|
|
21
|
+
|
|
22
|
+
## Contributing
|
|
23
|
+
|
|
24
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
25
|
+
|
|
26
|
+
### Install dependencies
|
|
27
|
+
|
|
28
|
+
If you have selected install_dependencies during the prompt, you can skip this part.
|
|
29
|
+
|
|
30
|
+
1. Install npm packages
|
|
31
|
+
```
|
|
32
|
+
$ npm install
|
|
33
|
+
```
|
|
34
|
+
2. Create a virtual env and activate.
|
|
35
|
+
```
|
|
36
|
+
$ virtualenv venv
|
|
37
|
+
$ . venv/bin/activate
|
|
38
|
+
```
|
|
39
|
+
_Note: venv\Scripts\activate for windows_
|
|
40
|
+
|
|
41
|
+
3. Install python packages required to build components.
|
|
42
|
+
```
|
|
43
|
+
$ pip install -r requirements.txt
|
|
44
|
+
```
|
|
45
|
+
4. Install the python packages for testing (optional)
|
|
46
|
+
```
|
|
47
|
+
$ pip install -r tests/requirements.txt
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Write your component code in `src/lib/components/DashFlow.react.js`.
|
|
51
|
+
|
|
52
|
+
- The demo app is in `src/demo` and you will import your example component code into your demo app.
|
|
53
|
+
- Test your code in a Python environment:
|
|
54
|
+
1. Build your code
|
|
55
|
+
```
|
|
56
|
+
$ npm run build
|
|
57
|
+
```
|
|
58
|
+
2. Run and modify the `usage.py` sample dash app:
|
|
59
|
+
```
|
|
60
|
+
$ python usage.py
|
|
61
|
+
```
|
|
62
|
+
- Write tests for your component.
|
|
63
|
+
- A sample test is available in `tests/test_usage.py`, it will load `usage.py` and you can then automate interactions with selenium.
|
|
64
|
+
- Run the tests with `$ pytest tests`.
|
|
65
|
+
- The Dash team uses these types of integration tests extensively. Browse the Dash component code on GitHub for more examples of testing (e.g. https://github.com/plotly/dash-core-components)
|
|
66
|
+
- Add custom styles to your component by putting your custom CSS files into your distribution folder (`dash_flow`).
|
|
67
|
+
- Make sure that they are referenced in `MANIFEST.in` so that they get properly included when you're ready to publish your component.
|
|
68
|
+
- Make sure the stylesheets are added to the `_css_dist` dict in `dash_flow/__init__.py` so dash will serve them automatically when the component suite is requested.
|
|
69
|
+
- [Review your code](./review_checklist.md)
|
|
70
|
+
|
|
71
|
+
### Create a production build and publish:
|
|
72
|
+
|
|
73
|
+
1. Build your code:
|
|
74
|
+
```
|
|
75
|
+
$ npm run build
|
|
76
|
+
```
|
|
77
|
+
2. Create a Python distribution
|
|
78
|
+
```
|
|
79
|
+
$ python setup.py sdist bdist_wheel
|
|
80
|
+
```
|
|
81
|
+
This will create source and wheel distribution in the generated the `dist/` folder.
|
|
82
|
+
See [PyPA](https://packaging.python.org/guides/distributing-packages-using-setuptools/#packaging-your-project)
|
|
83
|
+
for more information.
|
|
84
|
+
|
|
85
|
+
3. Test your tarball by copying it into a new environment and installing it locally:
|
|
86
|
+
```
|
|
87
|
+
$ pip install dash_flow-0.0.1.tar.gz
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
4. If it works, then you can publish the component to NPM and PyPI:
|
|
91
|
+
1. Publish on PyPI
|
|
92
|
+
```
|
|
93
|
+
$ twine upload dist/*
|
|
94
|
+
```
|
|
95
|
+
2. Cleanup the dist folder (optional)
|
|
96
|
+
```
|
|
97
|
+
$ rm -rf dist
|
|
98
|
+
```
|
|
99
|
+
3. Publish on NPM (Optional if chosen False in `publish_on_npm`)
|
|
100
|
+
```
|
|
101
|
+
$ npm publish
|
|
102
|
+
```
|
|
103
|
+
_Publishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash serves the component library's CSS and JS locally, but if you choose to publish the package to NPM you can set `serve_locally` to `False` and you may see faster load times._
|
|
104
|
+
|
|
105
|
+
5. Share your component with the community! https://community.plotly.com/c/dash
|
|
106
|
+
1. Publish this repository to GitHub
|
|
107
|
+
2. Tag your GitHub repository with the plotly-dash tag so that it appears here: https://github.com/topics/plotly-dash
|
|
108
|
+
3. Create a post in the Dash community forum: https://community.plotly.com/c/dash
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Dash-Flow
|
|
2
|
+
|
|
3
|
+
A Dash component library that integrates React Flow functionality into Dash applications, enabling interactive node-based interfaces with support for animated edges, resizable nodes, and custom components.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✨ Interactive node-based diagrams
|
|
8
|
+
- 🎯 Animated edges with node movement
|
|
9
|
+
- 📏 Resizable nodes with custom content
|
|
10
|
+
- 🎨 Custom node and edge styling
|
|
11
|
+
- 🔧 Developer tools for debugging
|
|
12
|
+
- 🖼️ Support for images and custom components
|
|
13
|
+
- 🎮 Interactive controls and minimap
|
|
14
|
+
- 🌈 Background customization
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Prerequisites
|
|
18
|
+
|
|
19
|
+
- Python 3.6+
|
|
20
|
+
- Dash 2.0+
|
|
21
|
+
- React 18.2.0+
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import dash
|
|
27
|
+
from dash import html
|
|
28
|
+
import dash_flow
|
|
29
|
+
import dash_mantine_components as dmc
|
|
30
|
+
|
|
31
|
+
app = dash.Dash(__name__)
|
|
32
|
+
|
|
33
|
+
# Define your nodes
|
|
34
|
+
nodes = [
|
|
35
|
+
{
|
|
36
|
+
'id': '1',
|
|
37
|
+
'type': 'resizable',
|
|
38
|
+
'data': {
|
|
39
|
+
'label': html.Div([
|
|
40
|
+
html.Img(src="your-image-url",
|
|
41
|
+
style={'width': '100%', 'height': '100%'})
|
|
42
|
+
])
|
|
43
|
+
},
|
|
44
|
+
'position': {'x': 250, 'y': 25},
|
|
45
|
+
'style': {
|
|
46
|
+
'width': 300,
|
|
47
|
+
'height': 300,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
# Define your edges
|
|
53
|
+
edges = [
|
|
54
|
+
{
|
|
55
|
+
'id': 'e1-2',
|
|
56
|
+
'source': '1',
|
|
57
|
+
'target': '2',
|
|
58
|
+
'type': 'animated',
|
|
59
|
+
'data': {
|
|
60
|
+
'animatedNode': '3' # Node to animate along this edge
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
# Create the layout
|
|
66
|
+
app.layout = dmc.MantineProvider([
|
|
67
|
+
dash_flow.DashFlow(
|
|
68
|
+
id='react-flow-example',
|
|
69
|
+
nodes=nodes,
|
|
70
|
+
edges=edges,
|
|
71
|
+
showDevTools=True,
|
|
72
|
+
style={'height': '600px'}
|
|
73
|
+
)
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
if __name__ == '__main__':
|
|
77
|
+
app.run_server(debug=True)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Components
|
|
81
|
+
|
|
82
|
+
### DashFlow
|
|
83
|
+
|
|
84
|
+
Main component that wraps React Flow functionality.
|
|
85
|
+
|
|
86
|
+
#### Props
|
|
87
|
+
|
|
88
|
+
- `id` (string): Component identifier
|
|
89
|
+
- `nodes` (list): Array of node objects
|
|
90
|
+
- `edges` (list): Array of edge objects
|
|
91
|
+
- `nodesDraggable` (boolean): Enable/disable node dragging
|
|
92
|
+
- `nodesConnectable` (boolean): Enable/disable creating connections
|
|
93
|
+
- `elementsSelectable` (boolean): Enable/disable selection
|
|
94
|
+
- `showMiniMap` (boolean): Show/hide minimap
|
|
95
|
+
- `showControls` (boolean): Show/hide controls
|
|
96
|
+
- `showBackground` (boolean): Show/hide background
|
|
97
|
+
- `showDevTools` (boolean): Show/hide developer tools
|
|
98
|
+
- `style` (dict): Custom container styles
|
|
99
|
+
|
|
100
|
+
### Node Types
|
|
101
|
+
|
|
102
|
+
#### ResizableNode
|
|
103
|
+
|
|
104
|
+
A node type that supports resizing and custom content.
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
node = {
|
|
108
|
+
'id': '1',
|
|
109
|
+
'type': 'resizable',
|
|
110
|
+
'data': {
|
|
111
|
+
'label': html.Div([...]) # Custom content
|
|
112
|
+
},
|
|
113
|
+
'position': {'x': 0, 'y': 0},
|
|
114
|
+
'style': {
|
|
115
|
+
'width': 300,
|
|
116
|
+
'height': 300
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Edge Types
|
|
122
|
+
|
|
123
|
+
#### AnimatedNodeEdge
|
|
124
|
+
|
|
125
|
+
An edge type that animates a node along its path.
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
edge = {
|
|
129
|
+
'id': 'e1-2',
|
|
130
|
+
'source': '1',
|
|
131
|
+
'target': '2',
|
|
132
|
+
'type': 'animated',
|
|
133
|
+
'data': {
|
|
134
|
+
'animatedNode': '3' # ID of node to animate
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Development
|
|
140
|
+
|
|
141
|
+
To contribute to this project:
|
|
142
|
+
|
|
143
|
+
1. Clone the repository
|
|
144
|
+
```bash
|
|
145
|
+
git clone https://github.com/yourusername/dash-flow.git
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
2. Install dependencies
|
|
149
|
+
```bash
|
|
150
|
+
npm install
|
|
151
|
+
pip install -r requirements.txt
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
3. Run the development server
|
|
155
|
+
```bash
|
|
156
|
+
npm start
|
|
157
|
+
python usage.py
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Building the Component
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npm run build
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT © [Pip Install Python](https://github.com/pip-install-python)
|
|
169
|
+
|