Skip to main content

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.

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mermaid_py-0.8.4.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mermaid_py-0.8.4-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

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

Hashes for mermaid_py-0.8.4.tar.gz
Algorithm Hash digest
SHA256 4676246ad32c4e9206d60af569f68ba7eab81e425d071fba01355b1cc6bba8f5
MD5 f67123112c3d1830fe96c0156487e296
BLAKE2b-256 0697323ccdcda694b246272193798bd866e0cbd209c09e578d313bb6837f2d6a

See more details on using hashes here.

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

Hashes for mermaid_py-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6e025c93c1ea7ce333aa60711e79ed166884376122516e3c52cf072e48d70791
MD5 7ba00aafd15fbdb0d52d7c6c2e0781f9
BLAKE2b-256 865facdf24a2f830e8f5f539623473c609f5472e2f687b1cbf6fd62e2964af91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page