Skip to main content

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 flows right-out -> left-in whatever 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/height so 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.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scivianna-graph 0.1.3
File Size Uploaded Provenance Actions
scivianna_graph-0.1.3.tar.gz 147.2 kB Without provenance Details for scivianna_graph-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scivianna-graph 0.1.3
File Interpreter ABI Platform Actions
scivianna_graph-0.1.3-py3-none-any.whl Python 3 none any Details for scivianna_graph-0.1.3-py3-none-any.whl

Total release size: 292.4 kB

Release files / scivianna_graph-0.1.3.tar.gz

Download URL scivianna_graph-0.1.3.tar.gz
Size 147.2 kB
Tags Source
SHA-256 checksum
How to use checksums
70722f8d92ecbfedae8c3bc8379fbcf165df970fb328a33a20fb0357f5700f78
BLAKE2b-256 checksum
How to use checksums
2ceeaee2dfa44d00379db0dc20ecc615ec6f24654f69e79eee84796f5de41a05
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.3-py3-none-any.whl

Download URL scivianna_graph-0.1.3-py3-none-any.whl
Size 145.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f5fed9c6f616de791d5f9ee23866db8c137a9eaf1672e802712a415a0128b7f
BLAKE2b-256 checksum
How to use checksums
47c4551791282719dc6860514004048526f79978375774390f22a84e01256239
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.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page