Skip to main content

Mermaid-py

this package works as an interface for the famous mermaid-js library that uses scripts to create diagrams.

Code Coverage GitHub LICENSE Mounthly Download latest version supported python version ruff badge

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 and Graph classes:
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.

Example Flowchart

  • using mermaidjs magic function in a notebook first import mermaid as md:
%%mermaidjs # with --img flag in case your notebook doesn't render HTML
flowchart LR
    A-->B
    B-->C

Example Flowchart

  • using FlowChart etc ...
from mermaid import *
from mermaid.flowchart import *

diagram = Mermaid(Flowchart(...))

diagram

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

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)

Source distribution for mermaid-py 0.9.0
File Size Uploaded
mermaid_py-0.9.0.tar.gz 36.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mermaid-py 0.9.0
File Interpreter ABI Platform
mermaid_py-0.9.0-py3-none-any.whl Python 3 none any Details

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}

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.0

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page