Python Interface for the Popular mermaid-js Library, Simplified for Diagram Creation.
Project description
Mermaid-py
this package works as an interface for the famous mermaid-js library that uses scripts to create diagrams.
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
MermaidandGraphclasses:
import mermaid as md
from mermaid.graph import Graph
render = md.Mermaid("""
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
""")
render # !! note this only works in the notebook that rendered the html.
- using
mermaidjsmagic 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
FlowChartetc ...
from mermaid import *
from mermaid.flowchart import *
diagram = Mermaid(Flowchart(...))
diagram
- more examples on mermaid and test-mermaid
Server
By default, the library uses the mermaid.ink service github for generating diagrams. The service can be run locally using docker, following instructions here.
The MERMAID_INK_SERVER environment variable can be used to specify the server to use, for example.
List of Diagrames
-
FlowChart -
Sequence Diagram - Class Diagram
-
State Diagram -
Entity Relationship Diagram -
User Journey - Gantt
-
Pie Chart - Quadrant Chart
-
Requirement Diagram - Gitgraph (Git) Diagram
- C4 Diagram 🦺⚠️
-
Mindmaps - Timeline
- Zenuml
- Sankey 🔥
- XYChart 🔥
- Block Diagram 🔥
- Packet 🔥
- Kanban 🔥
- Architecture 🔥
- Radar 🔥
- Treemap 🔥
- Venn 🔥
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 contact.ouhammou@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mermaid_py-0.8.4.tar.gz.
File metadata
- Download URL: mermaid_py-0.8.4.tar.gz
- Upload date:
- Size: 35.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4676246ad32c4e9206d60af569f68ba7eab81e425d071fba01355b1cc6bba8f5
|
|
| MD5 |
f67123112c3d1830fe96c0156487e296
|
|
| BLAKE2b-256 |
0697323ccdcda694b246272193798bd866e0cbd209c09e578d313bb6837f2d6a
|
File details
Details for the file mermaid_py-0.8.4-py3-none-any.whl.
File metadata
- Download URL: mermaid_py-0.8.4-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e025c93c1ea7ce333aa60711e79ed166884376122516e3c52cf072e48d70791
|
|
| MD5 |
7ba00aafd15fbdb0d52d7c6c2e0781f9
|
|
| BLAKE2b-256 |
865facdf24a2f830e8f5f539623473c609f5472e2f687b1cbf6fd62e2964af91
|