Mermaid-py
this package works as an interface for the famous mermaid-js library that uses scripts to create diagrams.
(opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab)
Description
mermaid-py is a dynamic Python library designed to serve as a seamless interface for the renowned Mermaid library. Built upon the powerful capabilities of Python, mermaid-py empowers developers and data enthusiasts to effortlessly create stunning diagrams, flowcharts, and visualizations directly within their Python environments.
Examples
first install the package using pip:
pip install mermaid-py
- using
Mermaid
andGraph
classes:
import mermaid as md
from mermaid.graph import Graph
sequence = Graph('Sequence-diagram',"""
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
""")
render = md.Mermaid(sequence)
render # !! note this only works in the notebook that rendered the html.
- using
mermaidjs
magic function in a notebook firstimport mermaid as md
:
%%mermaidjs # with --img flag in case your notebook doesn't render HTML
flowchart LR
A-->B
B-->C
- using
FlowChart
etc ...
from mermaid import *
from mermaid.flowchart import *
diagram = Mermaid(Flowchart(...))
diagram
- more examples on mermaid (opens in a new tab) and test-mermaid (opens in a new tab)
List of Diagrames
-
FlowChart(opens in a new tab) -
Sequence Diagram(opens in a new tab) - Class Diagram (opens in a new tab)
-
State Diagram(opens in a new tab) -
Entity Relationship Diagram(opens in a new tab) -
User Journey(opens in a new tab) - Gantt (opens in a new tab)
-
Pie Chart(opens in a new tab) - Quadrant Chart (opens in a new tab)
-
Requirement Diagram(opens in a new tab) - Gitgraph (Git) Diagram (opens in a new tab)
- C4 Diagram 🦺⚠️ (opens in a new tab)
-
Mindmaps(opens in a new tab) - Timeline (opens in a new tab)
- Zenuml (opens in a new tab)
- Sankey (opens in a new tab)
- XYChart 🔥 (opens in a new tab)
- Block Diagram 🔥 (opens in a new tab)
- Packet 🔥 (opens in a new tab)
- Architecture 🔥 (opens in a new tab)
License
This project is licensed under the MIT License.
Contact
If you have any questions or want to get in touch, you can reach out to me at rachidouhammou21@gmail.com.