Skip to main content

A (quite) simple that helps creating on-the-fly Mermaid diagrams

Project description

Python-Mermaid

This modules aims to implement a simple way for developers/admin-sys/devops to create on-the-fly Mermaid diagrams.

Installation

pip install python_mermaid

How to use

All examples are available here

Run the script below to see diagram generation

# Creating a simple flowchart diagram
from python_mermaid.diagram import (
    MermaidDiagram,
    Node,
    Link
)

# Family members
meg = Node("Meg")
jo = Node("Jo")
beth = Node("Beth")
amy = Node("Amy")
robert = Node("Robert March")

the_march_family = [meg, jo, beth, amy, robert]

# Create links
family_links = [
    Link(robert, meg),
    Link(robert, jo),
    Link(robert, beth),
    Link(robert, amy),
]

chart = MermaidDiagram(
    title="Little Women",
    nodes=the_march_family,
    links=family_links
)

print(chart)

Returns the following

---
title: Little Women
---
graph 
meg["Meg"]
jo["Jo"]
beth["Beth"]
amy["Amy"]
robert_march["Robert March"]
robert_march ---> meg
robert_march ---> jo
robert_march ---> beth
robert_march ---> amy

which results can be seen here

Roadmap

Check issues for more information

Development

  • Requirements: install Poetry. Here is the official method below. ⚠️ Please consider getting a look at Poetry's documentation if it doesn't work. ⚠️
curl -sSL https://install.python-poetry.org | python3 -
  • All-in-one command below to clone and install dependencies
curl -sSL https://install.python-poetry.org | python3 -
git clone https://github.com/Dynnammo/python_mermaid
cd python_mermaid
poetry shell
poetry install --with dev

To launch tests:

poetry run pytest

To check linting:

poetry run flake8

This project comes with a tool called pre-commit that checks if your code is correctly linted. If you want to use it, run the following

pre-commit install

Contribute

Wanna help ? Find a bug ?

  1. Do not hesitate to fork the repository and send PRs with your changes
  2. No time to code ? Send a bug/feature issue here

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

python_mermaid-0.1.3.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

python_mermaid-0.1.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file python_mermaid-0.1.3.tar.gz.

File metadata

  • Download URL: python_mermaid-0.1.3.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.8 Linux/5.10.157-1-MANJARO

File hashes

Hashes for python_mermaid-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8c9cd781fdfc8ed958513782a982254037913f3d1d893018691044bafa3bd441
MD5 bf4df286fba697dae887172bf13c4dc9
BLAKE2b-256 2ae8ccdc140d09877486f5814060476c2cb707f252242b27f8c9e7b6c3d6bc88

See more details on using hashes here.

File details

Details for the file python_mermaid-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: python_mermaid-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.8 Linux/5.10.157-1-MANJARO

File hashes

Hashes for python_mermaid-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7d283d98b21b97feb428593905fb8b35e4cd8dbd038aa3ef1e09118d4a91ea89
MD5 e6a09988b6080a9d8ed18edb3958857e
BLAKE2b-256 320e0cfafb065fa97132c61fd7d086e29aa94e62e51028d4577ef08dcd13dae7

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