A Python-based DOT language interpreter with multiple API styles for creating flowcharts and diagrams effortlessly.
- Multiple API Styles: Pythonic, natural language, and textual DSL
- Auto-shapes: Predefined shapes for common elements
- Clustering: Group nodes logically
- Themes: Built-in color schemes
- Export: PNG, SVG, PDF and DOT file export
pip install dotflow-pyfrom dotflow import Flow, create_flow
# Pythonic API
flow = create_flow("my_flow")
(flow.start("Start")
.process("Process Data")
.decision("Valid?")
.connect("Valid?", "End", label="Yes")
.connect("Valid?", "Process Data", label="No"))
flow.render("png", "my_flow.png")flow.process("A").connect("A", "B", label="Next")flow >> "A" >> "B" | "Label"flow.parse_dsl("""
A [shape=rect, label='Custom']
B [shape=rect, label="decision"]
C [shape=diamond, label=process]
A->B:Input Data
B{decison}->C:Valid
# End of of diagram
""")DotFlow provides a powerful CLI for generating diagrams without writing Python code.
# Generate from DSL text - Line breaks a mandatory just lik in dsl file
dotflow generate my_diagram.png --dsl-text \
"
A
B
A->B
" --theme green
# Generate from DSL file
dotflow generate diagram.svg --dsl-file workflow.dsl --theme dark
# Generate DOT file
dotflow generate workflow.dot --dsl-file workflow.dsl --format dot- Interactive Wizard
# Interactive flow creation
dotflow wizard my_flow.png --interactive
# Quick sample flow
dotflow wizard sample.png- Validation
# Validate DSL syntax
dotflow validate workflow.dsl- Examples
# Generate example diagrams
dotflow examples --format svg --theme blue
# Generate DSL cheat sheet
dotflow cheat-sheet- Themes
# List available themes
dotflow themes- DSL Syntax
The textual DSL supports:
# Comments
# First lets define the nodes
Start[shape=ellipse]
Valid[shape=diamond, label="Valid?"]
Process
ErrorHandler[label='Error Handler']
Storage
End[shape=ellipse]
# make decisions and connect nodes
# Validate data
Start{decision}->Valid:Validate
Valid->Process:isValid
Process->Storage:Store data
# Handle processing errors
Process->ErrorHandler:Processing Error
Storage->End:Finalize
# Handle invalid data
Valid->ErrorHandler:Invalid data
ErrorHandler->End
- Install the package:
pip install -e .- Basic CLI usage:
# Generate a simple flow
dotflow generate my_diagram.png --dsl-text \
"
A
B
A->B
" \
--theme dark
# Use interactive wizard
dotflow wizard my_flow.png --interactive
# Validate DSL file
dotflow validate my_workflow.dsl
# Generate all examples
dotflow examples --format svg- Using as Python module:
python -m dotflow generate diagram.png --dsl-text "
A
B
A->B
" \
--theme blue[] Multiple Commands: generate, wizard, validate, themes, examples, cheat-sheet
[] Interactive Mode: Build flows step-by-step
[] Comprehensive Validation: DSL syntax checking
[] Theme Support: All available themes accessible via CLI
[] Example Generation: Pre-built example diagrams
[] Error Handling: Robust error messages and exit codes
[] Testing: Complete test suite for CLI functionality
[] Flexible Output: Multiple formats (PNG, SVG, PDF, DOT)
The CLI makes the package accessible to users who prefer command-line tools or want to integrate diagram generation into scripts and automation workflows.
See full documentation for advanced usage.
- This product is licensed under MIT license see license