graph_widget 0.1.0__tar.gz → 0.1.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.
- graph_widget-0.1.2/.gitignore +10 -0
- graph_widget-0.1.2/PKG-INFO +69 -0
- graph_widget-0.1.2/README.md +62 -0
- graph_widget-0.1.2/README_DEV.md +6 -0
- graph_widget-0.1.2/data.json +1 -0
- graph_widget-0.1.2/example.py +144 -0
- graph_widget-0.1.2/multi_mst.json +1 -0
- graph_widget-0.1.2/pyproject.toml +14 -0
- graph_widget-0.1.2/src/graph_widget/__init__.py +31 -0
- {graph_widget-0.1.0 → graph_widget-0.1.2}/src/graph_widget/dev.py +2 -2
- graph_widget-0.1.0/src/graph_widget/graph.js → graph_widget-0.1.2/src/graph_widget/static/widget.js +5 -13
- {graph_widget-0.1.0 → graph_widget-0.1.2}/uv.lock +12 -223
- graph_widget-0.1.0/.gitignore +0 -10
- graph_widget-0.1.0/PKG-INFO +0 -16
- graph_widget-0.1.0/README.md +0 -4
- graph_widget-0.1.0/pyproject.toml +0 -19
- {graph_widget-0.1.0 → graph_widget-0.1.2}/.python-version +0 -0
- /graph_widget-0.1.0/src/graph_widget/__init__.py → /graph_widget-0.1.2/dev.py +0 -0
- /graph_widget-0.1.0/src/graph_widget/graph.css → /graph_widget-0.1.2/src/graph_widget/static/widget.css +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: graph_widget
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Requires-Dist: anywidget
|
|
5
|
+
Requires-Dist: marimo
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
|
|
8
|
+
# graph_widget
|
|
9
|
+
An anywidget implementation of force-graph (https://github.com/vasturiano/force-graph). It includes a brush (Cmd-drag).
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pip install graph_widget
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or with [uv](https://github.com/astral-sh/uv):
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
uv add graph_widget
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
An example marimo script (available as `example.py` => run with `uv run marimo edit example.py`):
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import graph_widget
|
|
29
|
+
import pandas as pd
|
|
30
|
+
import json
|
|
31
|
+
import requests
|
|
32
|
+
|
|
33
|
+
url = "https://raw.githubusercontent.com/observablehq/sample-datasets/refs/heads/main/miserables.json"
|
|
34
|
+
response = requests.get(url)
|
|
35
|
+
data = response.json()
|
|
36
|
+
|
|
37
|
+
repulsion_slider = mo.ui.slider(
|
|
38
|
+
start=-200, stop=10000, step=10, value=1, debounce=False, label="Repulsion"
|
|
39
|
+
)
|
|
40
|
+
node_scale_slider = mo.ui.slider(
|
|
41
|
+
start=1, stop=500, step=1, value=20, debounce=True, label="Node scale"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
data_graph = mo.ui.anywidget(
|
|
45
|
+
graph_widget.ForceGraphWidget(
|
|
46
|
+
data=data,
|
|
47
|
+
repulsion=repulsion_slider.value,
|
|
48
|
+
node_scale=node_scale_slider.value
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
mo.hstack([ data_graph,
|
|
53
|
+
mo.vstack([
|
|
54
|
+
repulsion_slider,
|
|
55
|
+
node_scale_slider])])
|
|
56
|
+
|
|
57
|
+
selected = data_graph.selected_ids
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
We recommend using [uv](https://github.com/astral-sh/uv) for development.
|
|
63
|
+
It will automatically manage virtual environments and dependencies for you.
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
uv run marimo edit example.py
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Changes made in `src/graph_widget/static/` will be reflected in the notebook.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# graph_widget
|
|
2
|
+
An anywidget implementation of force-graph (https://github.com/vasturiano/force-graph). It includes a brush (Cmd-drag).
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pip install graph_widget
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or with [uv](https://github.com/astral-sh/uv):
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
uv add graph_widget
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
An example marimo script (available as `example.py` => run with `uv run marimo edit example.py`):
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import graph_widget
|
|
22
|
+
import pandas as pd
|
|
23
|
+
import json
|
|
24
|
+
import requests
|
|
25
|
+
|
|
26
|
+
url = "https://raw.githubusercontent.com/observablehq/sample-datasets/refs/heads/main/miserables.json"
|
|
27
|
+
response = requests.get(url)
|
|
28
|
+
data = response.json()
|
|
29
|
+
|
|
30
|
+
repulsion_slider = mo.ui.slider(
|
|
31
|
+
start=-200, stop=10000, step=10, value=1, debounce=False, label="Repulsion"
|
|
32
|
+
)
|
|
33
|
+
node_scale_slider = mo.ui.slider(
|
|
34
|
+
start=1, stop=500, step=1, value=20, debounce=True, label="Node scale"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
data_graph = mo.ui.anywidget(
|
|
38
|
+
graph_widget.ForceGraphWidget(
|
|
39
|
+
data=data,
|
|
40
|
+
repulsion=repulsion_slider.value,
|
|
41
|
+
node_scale=node_scale_slider.value
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
mo.hstack([ data_graph,
|
|
46
|
+
mo.vstack([
|
|
47
|
+
repulsion_slider,
|
|
48
|
+
node_scale_slider])])
|
|
49
|
+
|
|
50
|
+
selected = data_graph.selected_ids
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Development
|
|
54
|
+
|
|
55
|
+
We recommend using [uv](https://github.com/astral-sh/uv) for development.
|
|
56
|
+
It will automatically manage virtual environments and dependencies for you.
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
uv run marimo edit example.py
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Changes made in `src/graph_widget/static/` will be reflected in the notebook.
|