Python-Mermaid
This modules aims to implement a simple way for developers/admin-sys/devops to create on-the-fly Mermaid diagrams.
✅ Use of this module when:
- keeping up-to-date diagrams about systems that can can be discovered with automated scripts :
- architecture of a server (packages, services,...)
- architecture of a folder (files and subfolders,...)
- keeping up-to-date diagrams about a data-visualization tool (like Metabase, Lightdash etc.)
- list of collections and indicators with their links for modification
❌ Do not use this module for
- making a single instance diagram that doesn't need to be updated : documentation, presentation etc.
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 TD
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
Available features
- Create basic flowcharts and statecharts
Roadmap
See issues
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
Quick commands
- Launch tests:
poetry run pytest - Check linting:
poetry run ruff check . - Check typing:
poetry run mypy python_mermaid
To check linting:
```shell
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 ?
- Do not hesitate to fork the repository and send PRs with your changes
- No time to code ? Send a bug/feature issue here
Metadata
Release files for python_mermaid 0.1.6
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 |
|---|---|---|---|---|
| python_mermaid-0.1.6.tar.gz | 17.4 kB | Without provenance | Details for python_mermaid-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_mermaid-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for python_mermaid-0.1.6-py3-none-any.whl |
Total release size: 36.8 kB
Release files / python_mermaid-0.1.6.tar.gz
| Download URL | python_mermaid-0.1.6.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
496fc9b7e3ebd1cf6205b9219c5a5ae313621b611571902a8d70b927a0fef96d
|
|
BLAKE2b-256 checksum How to use checksums |
76ddf0fb6af68b7ef662ea7ba076ae7bf55ecbc7d8eca1085e3b258a135f7045
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.3 Linux/6.12.28-1-MANJARO
|
Release files / python_mermaid-0.1.6-py3-none-any.whl
| Download URL | python_mermaid-0.1.6-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b20cb081eab31fa765d5a5a6f126a8d98c3bfe0fd20163425fd025565b1a0cc
|
|
BLAKE2b-256 checksum How to use checksums |
fdc5218c0fd79f15735ba6bd2f96983b3756256e3a15425eeed0a8523749e236
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.3 Linux/6.12.28-1-MANJARO
|
Security for python_mermaid 0.1.6
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.