Review - PyFlowchart

I was looking for a quick and simple way to generate flow-charts. Specifically, I wanted to illustrate the customer onboarding flow for a web app including (registration, user verification, enable 2fa, etc.) As I have been up-skilling in Python, I googled python flowchart generator and the first result was PyFlowchart.

I skimmed through PyFlowchart I decided to give it a go. And after about 5 minutes I had created a flowchart from a simple set of instructions :) I have since used it to create a whole series of flowcharts and I'm v satisfied with it.

Getting started with PyFlowchart

1. Step one: install pyflowchart via the command line

$ pip3 install pyflowchart

2. Create a new python (.py) file and import all from pyflowchart

#first-flowchart.py
from pyflowchart import *

3. Get familiar with PyFlowchart node types

Node Type Example
StartNode start = StartNode('Registration')
ConditionNode cond = ConditionNode('Already have an account?')
InputOutputNode io_enter = InputOutputNode(InputOutputNode.INPUT, 'Enter Email & Password')
OperationNode op = OperationNode('Confirm Email')
InputOutputNode io_confirmation = InputOutputNode(InputOutputNode.OUTPUT, 'Account Created')
SubroutineNode sub_login = SubroutineNode('Login')
EndNode end = EndNode('Goodbye')

4. Learn how to connect nodes

Nodes can be connected by [...].connect(...) method (connectyes or connectnow for ConditionNode)

start.connect(cond)
cond.connect_no(io_enter)
cond.connect_yes(sub_login)
...

5. Put it all together and generated flowchart domain specific language (DSL)

Get a Flowchart with your start node and call its flowchart() method to generate flowchart.js flowchart DSL

# first-flowchart.py

to be added

Save the above file and in the command line, run

$ python3 first-flowchat.py

Then copy the output and paste into flowchart.js


to be added

Voila, flowchart.js generates the corresponding flowchart which you can then save as and use elsehwhere.

More from 0x21e6
All posts