A simple interface for the the famous lib mermaid-js to create diagrams.
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 mermaid-py
by pip install mermaid-py
.
- using
Mermaid
andGraph
classes:
import mermaid as md
from mermaid.graph import Graph
graph: Graph = Graph('example-flowchart',"""
flowchart TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
""")
graphe: md.Mermaid = md.Mermaid(graph)
graphe # !! note this work just in notbooke that render html.
the result will be like this
- using
mermaidjs
magic function in a notebook firstimport mermaid as md
:
%%mermaidjs # with --img flag in case your natebook doesn't render html
flowchart LR
A-->B
B-->C
the result:
- using
FlowChart
etc ...
from mermaid import *
from mermaid.flowchart import *
diagram = Mermaid(Flowchart(...))
diagram
- more examples on mermaid and test-mermaid
Technologies Used
- Python3
- Poetry
To contribute to mermaid-py
If you'd like to contribute to this open source project folow this steps:
- Forke the repo and then clone it.
- Navigate to the project directory:
cd mermaid-py
. - create a local enviroment
python3 -m venv env
. - activate the env
source env/bin/activate
. - install the dependecies
poetry install
. - happy coding :) .
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 🔥
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.
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
File details
Details for the file mermaid_py-0.5.0.tar.gz
.
File metadata
- Download URL: mermaid_py-0.5.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.14 Linux/6.5.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7594f415208be84b22ac18b4a98b50f647cb3f88cb32ff9fd082e84a0e4e2ba |
|
MD5 | 4c0d180cb1dc6c0b8d79b02527cfa79e |
|
BLAKE2b-256 | ef05fc41a1bf41ac290d3cc3e32c7a659e4855c76a97d44fe03e61709f48c31e |
File details
Details for the file mermaid_py-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: mermaid_py-0.5.0-py3-none-any.whl
- Upload date:
- Size: 31.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.14 Linux/6.5.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 269c8bc333864cb8c83cbdf709a31a02a1050250c1f04164ddabc5a979da00d9 |
|
MD5 | 6099a8f55e8c1cb35275fdcedc937436 |
|
BLAKE2b-256 | 13907e5c12544abe4e6a780f4e1f1d291d52170328ad9a7bb888ce4db02e39a8 |