A Panel wrapper for the Reactflow JS library.
Project description
✨ panel-reactflow
A Panel wrapper for the React Flow JS library.
Features
- Python-first, JSON-serializable graph state
- Panel viewables inside nodes via node
viewentries - Interactive editing (drag/select/connect/delete) with sync back to Python
- Optional schema definitions for node/edge properties
- Event callbacks via
ReactFlow.on(...)for app-level handling (callback signature:callback(payload, flow))
Pin your version!
This project is in its early stages, so if you find a version that suits your needs, it’s recommended to pin your version, as updates may introduce changes.
Installation
Install it via pip:
pip install panel-reactflow
Usage
import panel as pn
from panel_reactflow import ReactFlow
pn.extension("jsoneditor")
nodes = [
{
"id": "n1",
"position": {"x": 0, "y": 0},
"type": "panel",
"label": "Start",
"data": {},
"view": pn.pane.Markdown("Node 1 content"),
},
{
"id": "n2",
"position": {"x": 260, "y": 60},
"type": "panel",
"label": "End",
"data": {},
"view": pn.pane.Markdown("Node 2 content"),
},
]
edges = [
{"id": "e1", "source": "n1", "target": "n2"},
]
flow = ReactFlow(
nodes=nodes,
edges=edges,
)
flow
For property schemas and richer editors, provide node_types/edge_types with PropertySpec and handle changes via ReactFlow.on(...). .on callbacks receive the event payload as the first argument and can optionally accept the ReactFlow instance as a second argument.
Development
git clone https://github.com/panel-extensions/panel-reactflow
cd panel-reactflow
For a simple setup use uv:
uv venv
source .venv/bin/activate # on linux. Similar commands for windows and osx
uv pip install -e .[dev]
pre-commit run install
pytest tests
For the full Github Actions setup use pixi:
pixi run pre-commit-install
pixi run postinstall
pixi run test
This repository is based on copier-template-panel-extension (you can create your own Panel extension with it)!
To update to the latest template version run:
pixi exec --spec copier --spec ruamel.yaml -- copier update --defaults --trust
Note: copier will show Conflict for files with manual changes during an update. This is normal. As long as there are no merge conflict markers, all patches applied cleanly.
❤️ Contributing
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/YourFeature. - Make your changes and commit them:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/YourFeature. - Open a pull request.
Please ensure your code adheres to the project's coding standards and passes all tests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file panel_reactflow-0.3.1a0.tar.gz.
File metadata
- Download URL: panel_reactflow-0.3.1a0.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9186325c164daffa3b88c6e511475e38bb8fc1ff5c3968d203340ed74cce2a74
|
|
| MD5 |
d766795ed8734eac0ebc18a2b18edd64
|
|
| BLAKE2b-256 |
4a47876f96188177113479a80d4de258042d8afd0687ac1eb7b5f5506a8c444b
|
Provenance
The following attestation bundles were made for panel_reactflow-0.3.1a0.tar.gz:
Publisher:
build.yml on panel-extensions/panel-reactflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panel_reactflow-0.3.1a0.tar.gz -
Subject digest:
9186325c164daffa3b88c6e511475e38bb8fc1ff5c3968d203340ed74cce2a74 - Sigstore transparency entry: 1185859685
- Sigstore integration time:
-
Permalink:
panel-extensions/panel-reactflow@9e456acb3eecfe395d3b8ad8241e1678cd3143b5 -
Branch / Tag:
refs/tags/v0.3.1a0 - Owner: https://github.com/panel-extensions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@9e456acb3eecfe395d3b8ad8241e1678cd3143b5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panel_reactflow-0.3.1a0-py3-none-any.whl.
File metadata
- Download URL: panel_reactflow-0.3.1a0-py3-none-any.whl
- Upload date:
- Size: 150.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5245fadf29b6033f8b2efc43e6646c7269445c50f70f3687effcd48f8daec258
|
|
| MD5 |
b279f88d1f1cbf8dcfca59f167d41bfb
|
|
| BLAKE2b-256 |
27cb4ac4a13ce94bce0cf3a49de3c41ab6567378b9d814bb1d70dc5fecf73170
|
Provenance
The following attestation bundles were made for panel_reactflow-0.3.1a0-py3-none-any.whl:
Publisher:
build.yml on panel-extensions/panel-reactflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panel_reactflow-0.3.1a0-py3-none-any.whl -
Subject digest:
5245fadf29b6033f8b2efc43e6646c7269445c50f70f3687effcd48f8daec258 - Sigstore transparency entry: 1185859687
- Sigstore integration time:
-
Permalink:
panel-extensions/panel-reactflow@9e456acb3eecfe395d3b8ad8241e1678cd3143b5 -
Branch / Tag:
refs/tags/v0.3.1a0 - Owner: https://github.com/panel-extensions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@9e456acb3eecfe395d3b8ad8241e1678cd3143b5 -
Trigger Event:
push
-
Statement type: