graph_widget
An anywidget implementation of force-graph (https://github.com/vasturiano/force-graph). It includes a brush (Cmd-drag).
Installation
pip install graph_widget
or with uv:
uv add graph_widget
Example
An example marimo script (available as example.py => run with uv run marimo edit example.py):
import graph_widget
import pandas as pd
import json
import requests
url = "https://raw.githubusercontent.com/observablehq/sample-datasets/refs/heads/main/miserables.json"
response = requests.get(url)
data = response.json()
repulsion_slider = mo.ui.slider(
start=-100, stop=500, step=10, value=1, debounce=False, label="Repulsion"
)
node_scale_slider = mo.ui.slider(
start=1, stop=20, step=1, value=3, debounce=True, label="Node scale"
)
colour_feature_dropdown = mo.ui.dropdown(
options=list(data["nodes"][3].keys()), value="kind", label="Colour by"
)
colour_scale_type_radio = mo.ui.radio(options=["diverging", "sequential"], value="diverging", label="Colour scale type")
data_graph = mo.ui.anywidget(
graph_widget.ForceGraphWidget(
data=data,
repulsion=2,
node_scale=2,
colour_feature="",
colour_scale_type=""
)
)
data_graph.repulsion = repulsion_slider.value
data_graph.node_scale = node_scale_slider.value
data_graph.colour_feature = colour_feature_dropdown.value
data_graph.colour_scale_type= colour_scale_type_radio.value
mo.hstack([data_graph,
mo.vstack([
repulsion_slider,
node_scale_slider,
colour_feature_dropdown,
colour_scale_type_radio])], justify="start")
selected = data_graph.selected_ids
Arguments
repulsionnode_scalecolour_featurecolour_scale_type: can be empty string, or"diverging"
Development
We recommend using uv for development. It will automatically manage virtual environments and dependencies for you.
uv run marimo edit example.py
Changes made in src/graph_widget/static/ will be reflected in the notebook.
Metadata
Release files for graph_widget 0.1.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| graph_widget-0.1.17.tar.gz | 182.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| graph_widget-0.1.17-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 188.8 kB
Release files / graph_widget-0.1.17.tar.gz
| Download URL | graph_widget-0.1.17.tar.gz |
|---|---|
| Size | 182.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6cfc09c65a8476886b44237257484c017e450a63c8105c96e460dff1c9d5260e
|
|
BLAKE2b-256 checksum How to use checksums |
2700b4694ad8c9c09f546c4912723dbcbbbc86a08423e46d47081b144bcc8850
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.9
|
Release files / graph_widget-0.1.17-py2.py3-none-any.whl
| Download URL | graph_widget-0.1.17-py2.py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4a8a2e91715f592763f042940d78ce583057f35866c9ac1a1d7609e241b26c74
|
|
BLAKE2b-256 checksum How to use checksums |
5d5bca3ce54716d4c2f4895b0c65e3c479e6d58a3a19023d29071f714fe6b545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.9
|
Security for graph_widget 0.1.17
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.