DotFlow
A Python-based DOT language interpreter with multiple API styles for creating flowcharts and diagrams effortlessly.
Features
- 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
Installation
pip install dotflow
Quick Start
from 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")
API Styles
Pythonic API
flow.process("A").connect("A", "B", label="Next")
Natural Language
flow >> "A" >> "B" | "Label"
Textual DSL
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
""")
Command Line Interface
DotFlow provides a powerful CLI for generating diagrams without writing Python code.
Basic Usage
# 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
Usage Examples
- 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
This CLI implementation provides:
[] 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.
Documentation
See full documentation for advanced usage.
License
- This product is licensed under MIT license see license
Support
Metadata
Release files for dotflow-py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dotflow_py-0.1.0.tar.gz | 36.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dotflow_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.3 kB
Release files / dotflow_py-0.1.0.tar.gz
| Download URL | dotflow_py-0.1.0.tar.gz |
|---|---|
| Size | 36.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc84257d7e7143e6b84bb3f8391138f4bd1e3013966bf0ef9aa8b6f5156ec125
|
|
BLAKE2b-256 checksum How to use checksums |
d3baa903ee72c5cb5c5346646c91e3ca38b227bd86d3165aba0b6c9d8f853625
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / dotflow_py-0.1.0-py3-none-any.whl
| Download URL | dotflow_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 42.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c869415990232593f2ee1788e5ab688e04ab799d5953ab0503db18f543de54b5
|
|
BLAKE2b-256 checksum How to use checksums |
ba2b49575bdc4f7772318be1fd435aa70742c6ad724c413a03e4a9e447d95350
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|