Skip to main content

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.

Code Coverage GitHub LICENSE Mounthly Download latest version suported python version

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 and Graph 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 only works in the notebook that rendered the html.

the result will be like this

Example Flowchart

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

the result:

Example Flowchart

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

diagram = Mermaid(Flowchart(...))

diagram

Technologies Used

  • Python3
  • Poetry

To contribute to mermaid-py

If you'd like to contribute to this open source project folow this steps:

  1. Forke the repo and then clone it.
  2. Navigate to the project directory: cd mermaid-py.
  3. create a local enviroment python3 -m venv env.
  4. activate the env source env/bin/activate.
  5. install the dependecies poetry install.
  6. happy coding :) .

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 rachidouhammou21@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.5.2.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

mermaid_py-0.5.2-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file mermaid_py-0.5.2.tar.gz.

File metadata

  • Download URL: mermaid_py-0.5.2.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1023-azure

File hashes

Hashes for mermaid_py-0.5.2.tar.gz
Algorithm Hash digest
SHA256 eb4ac05cb7e86a33f49e1f2d376b3b2817d5f59385f4faa3521897a6180f864f
MD5 5d635548a79ef9fab85708a1702cd619
BLAKE2b-256 f2dd38683e6d4d0ab373ba4ad1830da5a70c3bd03baa40a755b2ca892835e11e

See more details on using hashes here.

File details

Details for the file mermaid_py-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: mermaid_py-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1023-azure

File hashes

Hashes for mermaid_py-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 905c7f62a61975809c52c208a36639ae48731f25f15bd9a8fb51cbc1411691a7
MD5 d99603070f251b2ef4f57ff70075d177
BLAKE2b-256 9fbb46763ef90c19f3ebc6070daa328ee1b9416f750cae79fa72dfd97b4767b9

See more details on using hashes here.

Supported by

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