Skip to content

A React Flow graph engine extension for the pytransitions state machine library.

License

Notifications You must be signed in to change notification settings

JohnsonLM/transitions-reactflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

transitions-reactflow

Tests

React Flow graph engine for pytransitions state machines.

Installation

pip install transitions-reactflow

Quick Start

from transitions_reactflow import ReactFlowMachine

states = ['idle', 'running', 'stopped']
transitions = [
    {'trigger': 'start', 'source': 'idle', 'dest': 'running'},
    {'trigger': 'stop', 'source': 'running', 'dest': 'stopped'}
]

machine = ReactFlowMachine(
    states=states,
    transitions=transitions,
    initial='idle'
)
graph_data = machine.get_graph()
# Returns: {'nodes': [...], 'edges': [...]}

Demo

See the demo app for complete examples including Flask backend for serving graph descriptions and React frontend for displaying the graphs.

Run the demo:

cd demo
npm i
npm run build
python server.py

Then visit http://localhost:5050 to see examples for all machine extensions.

Credits

Built on pytransitions.

About

A React Flow graph engine extension for the pytransitions state machine library.

Resources

License

Stars

Watchers

Forks

Languages