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:
export MERMAID_INK_SERVER="http://localhost:8080"
When connecting to an internal or self-signed Mermaid Ink server, you can disable certificate verification with:
export MERMAID_INK_SERVER_VERIFY_SSL=false
The default is true, which keeps SSL certificate validation enabled for public HTTPS endpoints.
List of Diagrames
- FlowChart
- Sequence Diagram
- State Diagram
- Entity Relationship Diagram
- User Journey
- Requirement Diagram
- Mindmap
- Pie Chart
- Generic Graph
- Class Diagram
- Gantt
- Gitgraph (Git) Diagram
- C4 Diagram
- 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.
Metadata
Release files for mermaid-py 0.9.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 | Provenance | Actions |
|---|---|---|---|---|
| mermaid_py-0.9.0.tar.gz | 36.1 kB | Without provenance | Details for mermaid_py-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mermaid_py-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for mermaid_py-0.9.0-py3-none-any.whl |
Total release size: 69.1 kB
Release files / mermaid_py-0.9.0.tar.gz
| Download URL | mermaid_py-0.9.0.tar.gz |
|---|---|
| Size | 36.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35080d4fed4680a4d598e8e2da967ba96d175b564f9101f46915fef273d14dbd
|
|
BLAKE2b-256 checksum How to use checksums |
122153c61560f20a8766d853709b90e3687606e9025c7e2fe2456352dda8937d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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}
|
Release files / mermaid_py-0.9.0-py3-none-any.whl
| Download URL | mermaid_py-0.9.0-py3-none-any.whl |
|---|---|
| Size | 33.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6abc53f9527118c147d59568852fe782dcdbe54d5512f23d0e3a1b5dec9a302b
|
|
BLAKE2b-256 checksum How to use checksums |
ec9d1832c79be2a87aece4ecbbddd3ae315b9cc90ae62c6755581afc06670867
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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}
|
Security for mermaid-py 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.