Skip to main content

A Panel wrapper for the Reactflow JS library.

Project description

✨ panel-reactflow

CI conda-forge pypi-version python-version

A Panel wrapper for the React Flow JS library.

panel-reactflow demo

Features

  • Python-first, JSON-serializable graph state
  • Panel viewables inside nodes via node view entries
  • 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:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/YourFeature.
  3. Make your changes and commit them: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature/YourFeature.
  5. Open a pull request.

Please ensure your code adheres to the project's coding standards and passes all tests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panel_reactflow-0.3.1.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

panel_reactflow-0.3.1-py3-none-any.whl (149.9 kB view details)

Uploaded Python 3

File details

Details for the file panel_reactflow-0.3.1.tar.gz.

File metadata

  • Download URL: panel_reactflow-0.3.1.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

Hashes for panel_reactflow-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bceb50e4ea7c9d1baa5228d2b20c9d7e713906d58a23caad233d83aa764ac5d8
MD5 483beb72ab99367c3b9f3ecb062bce3b
BLAKE2b-256 4d7287c149d42bd80dd970c99093be4f7aff9bf59b933c6221d1babd2e80bb67

See more details on using hashes here.

Provenance

The following attestation bundles were made for panel_reactflow-0.3.1.tar.gz:

Publisher: build.yml on panel-extensions/panel-reactflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file panel_reactflow-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: panel_reactflow-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 149.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for panel_reactflow-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb94d4c6a8b37e9cdb54d37610c60fb1d7b0fa3b1bb047a9f9db9e5aae877104
MD5 ae2a6c4ff5e653f6193765335aeb6c1b
BLAKE2b-256 3a1feeeb2ac07f522d8d6f79e80955241132585227b449509b8c8cf1e9ef8b8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for panel_reactflow-0.3.1-py3-none-any.whl:

Publisher: build.yml on panel-extensions/panel-reactflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page