Allow creating graphs with parameterized Node and Edge instances#54
Merged
philippjfr merged 2 commits intomainfrom Mar 13, 2026
Merged
Allow creating graphs with parameterized Node and Edge instances#54philippjfr merged 2 commits intomainfrom
philippjfr merged 2 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds first-class instance-based graph elements to Panel-ReactFlow by introducing
NodeandEdgebase classes and wiring them into the core sync/event/editor pipeline.Users can now pass
Node/Edgeobjects directly (not just dicts), define reusable subclasses with parameters, and build object-oriented graph workflows with automatic two-waydatasynchronization.What’s included
Node(with shared node fields,to_dict(), optional__panel__, editor hook,on_*hooks)Edge(with shared edge fields,to_dict(), editor hook,on_*hooks)NodeandEdgein package API.ReactFlowto accept/retainNodeandEdgeinstances innodes/edges._process_param_change.on_event,on_add,on_delete, etc.).node.editor(...),edge.editor(...)).precedence >= 0:dataDocs
__panel__usage>= 0) for data/schema inclusionTests
Added/extended tests to cover:
Node/Edgeinstancesdata+ schema generationAll relevant tests pass locally.
Test plan
pytest tests/test_api.py tests/test_core.py -qpython -m py_compile examples/node_edge_instances.pypython -m py_compile examples/threejs_viewer_instances.pyBackward compatibility
NodeSpec/EdgeSpecusage is preserved.