scivianna-graph
Build interactive ReactFlow graphs from a plain-Python model. Each node is an embedded Panel/Bokeh figure on a draggable, zoomable canvas - ideal for visualizing the topology of coupled simulations or 1D pipe networks where the plots need to be rotated, plugged on any side and rearranged by hand.
from scivianna_graph import GraphModel, GraphNode, GraphEdge, SciviannaGraph
model = GraphModel()
model.add_node(GraphNode(id="core", position=(0, 0), label="Core", rotation=15))
model.add_node(GraphNode(id="assembly", position=(420, 0), label="Assembly"))
model.add_edge(
GraphEdge(source="core", target="assembly",
source_direction="right", target_direction="left")
)
SciviannaGraph(model).make_panel().servable()
Features
- Plugs on every side - each node exposes handles on all four sides
(
top/bottom/left/right). An edge declares which side it attaches to on each endpoint, and directions are expressed in the node's own frame, so a pipe flowsright-out -> left-inwhatever its rotation. - Rotatable nodes - rotate any node (border, handles and figure together) by an
angle in degrees. An optional fixed pivot (
rotation_origin) keeps a point in place while the node rotates - e.g. rotate a pipe about its inlet so pipes fan out radially. - Group drag-select - drag an empty area of the canvas to marquee-select several nodes and move them together; drag a single node to reposition it.
- Embedded figures - each node renders any Panel viewable (typically a Bokeh
figure). Give the viewable explicit
width/heightso the node is sized correctly. - Zoom, pan, minimap, controls - standard ReactFlow navigation, all optional.
Install
pip install scivianna-graph
The frontend bundle ships with the package, so no build step or network access is needed at runtime.
Usage
GraphModel is plain Python (no frontend required) and can be built, inspected and
serialized on its own:
from scivianna_graph import GraphModel, GraphNode, GraphEdge
model = GraphModel()
model.add_node(GraphNode(id="a", position=(0, 0), label="Inlet",
view=bokeh_pane_a)) # optional embedded figure
model.add_node(GraphNode(id="b", position=(300, 0), label="Core",
rotation=90, # rotate about the centre ...
data={"rotation_origin": (0.5, 1.0)})) # ... or about a pivot
model.add_edge(GraphEdge(source="a", target="b",
source_direction="right", target_direction="left"))
graph = SciviannaGraph(model)
graph.make_panel().servable()
Nodes may carry an embedded Panel viewable (e.g. a Bokeh figure wrapped in
pn.pane.Bokeh) via GraphNode(view=...).
Display options are passed as SciviannaGraph(...) kwargs: min_zoom, max_zoom,
show_controls, show_minimap, enable_multiselect, show_unconnected_ports
(default false: only plugs used by an edge are drawn) and rotation_origin (default
pivot for every node).
API
| Name | Purpose |
|---|---|
GraphModel |
Container of nodes and edges; add_node, add_edge, get_node, validate, to_dict. |
GraphNode |
A node: id, position, optional label, view, rotation, data. |
GraphEdge |
A directed edge: source, target, source_direction, target_direction, optional label. |
SciviannaGraph |
Builds the canvas from a GraphModel; set_model, make_panel, and in-place set_node_* / set_edge_* helpers. |
Development
The frontend is a standalone React app (src/scivianna_graph/dist/app.jsx) compiled
to SciviannaGraphCanvas.bundle.js (+ .bundle.css). To rebuild it after editing the
JSX, run from the repository root:
./build.sh # or: npm run build
build.sh runs npm install (local esbuild) and then panel compile. It needs node,
npm, network access for the first run, and pip install panel. Rebuild after every
change to app.jsx. Without a bundle, Panel compiles the JSX in the browser and fetches
@xyflow/react from esm.sh (needs network). See AGENTS.md for build notes and gotchas.
Metadata
Release files for scivianna-graph 0.1.5
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 | Actions |
|---|---|---|---|---|
| scivianna_graph-0.1.5.tar.gz | 150.5 kB | Without provenance | Details for scivianna_graph-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scivianna_graph-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for scivianna_graph-0.1.5-py3-none-any.whl |
Total release size: 299.1 kB
Release files / scivianna_graph-0.1.5.tar.gz
| Download URL | scivianna_graph-0.1.5.tar.gz |
|---|---|
| Size | 150.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96ab17ec046016f3f247d34d3f0c35c07d567a634e372b02bd04f73d33ef9b05
|
|
BLAKE2b-256 checksum How to use checksums |
b7b3724686802f318358162bb6262ea3366094b8942ffa8f7a9f1eefa71bb440
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / scivianna_graph-0.1.5-py3-none-any.whl
| Download URL | scivianna_graph-0.1.5-py3-none-any.whl |
|---|---|
| Size | 148.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcd1c1a8e318cfb67d4ac828a610c49255c62b64a650d4c4872482ac9d00e73d
|
|
BLAKE2b-256 checksum How to use checksums |
e5d4119084fc2067b96562a9c70a82fe5ded0efdf9fbb8a9b9c2007e0cff942a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for scivianna-graph 0.1.5
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.