mermaid-py


Namemermaid-py JSON
Version 0.7.1 PyPI version JSON
download
home_pagehttps://mermaidpy.vercel.app
SummaryPython Interface for the Popular mermaid-js Library, Simplified for Diagram Creation.
upload_time2025-02-23 08:34:08
maintainerNone
docs_urlNone
authorouhammmourachid
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mermaid-py

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

[![Code Coverage](https://codecov.io/gh/ouhammmourachid/mermaid-py/graph/badge.svg?token=732C2PA73Z)](https://codecov.io/gh/ouhammmourachid/mermaid-py)
[![GitHub LICENSE](https://img.shields.io/github/license/ouhammmourachid/mermaid-py)](https://github.com/ouhammmourachid/mermaid-py/blob/main/LICENSE)
[![Mounthly Download](https://img.shields.io/pypi/dm/mermaid-py)](https://pypistats.org/packages/mermaid-py)
[![latest version](https://img.shields.io/pypi/v/mermaid-py.svg?style=flat)](https://pypi.org/project/mermaid-py/)
[![supported python version](https://img.shields.io/pypi/pyversions/mermaid-py)](https://pypi.org/project/mermaid-py)
[![ruff badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![mermaid-py on snyk](https://snyk.io/advisor/python/mermaid-py/badge.svg)](https://snyk.io/advisor/python/mermaid-py)


## 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:

```bash
pip install mermaid-py
```

- using `Mermaid` and `Graph` classes:
```python
import mermaid as md
from mermaid.graph import Graph

sequence = Graph('Sequence-diagram',"""
stateDiagram-v2
    [*] --> Still
    Still --> [*]

    Still --> Moving
    Moving --> Still
    Moving --> Crash
    Crash --> [*]
""")
render = md.Mermaid(sequence)
render # !! note this only works in the notebook that rendered the html.
```

<p align="center">
   <img src="https://github.com/user-attachments/assets/8476ec24-b41f-4a88-9c30-a2478a2c0fd8" alt="Example Flowchart"
    style="width: 20%;">
</p>

- using `mermaidjs` magic function in a notebook first `import mermaid as md`:

```python
%%mermaidjs # with --img flag in case your notebook doesn't render HTML
flowchart LR
    A-->B
    B-->C
```

<p align="center">
    <img src="https://github.com/ouhammmourachid/mermaid-py/assets/93659459/d4d1b993-a33d-4eb0-82ae-2ad39bf30e90" alt="Example Flowchart"
    style="width: 20%;">
</p>

- using `FlowChart` etc ...

```python
from mermaid import *
from mermaid.flowchart import *

diagram = Mermaid(Flowchart(...))

diagram
```
- more examples on [mermaid](https://www.kaggle.com/code/ouhammourachid/mermaid-py) and [test-mermaid](https://www.kaggle.com/code/ouhammourachid/testing-mermaid-py)

## Server

By default, the library uses the mermaid.ink service [github](https://github.com/jihchi/mermaid.ink) for generating diagrams. The service can be run locally using docker, following instructions [here](https://github.com/jihchi/mermaid.ink?tab=readme-ov-file#launch-a-container).

The `MERMAID_INK_SERVER` environment variable can be used to specify the server to use, for example.

## List of Diagrames
- [x] [~~FlowChart~~](https://mermaid.js.org/syntax/flowchart.html)
- [x] [~~Sequence Diagram~~](https://mermaid.js.org/syntax/sequenceDiagram.html)
- [ ] [Class Diagram](https://mermaid.js.org/syntax/classDiagram.html)
- [x] [~~State Diagram~~](https://mermaid.js.org/syntax/stateDiagram.html)
- [x] [~~Entity Relationship Diagram~~](https://mermaid.js.org/syntax/entityRelationshipDiagram.html)
- [x] [~~User Journey~~](https://mermaid.js.org/syntax/userJourney.html)
- [ ] [Gantt](https://mermaid.js.org/syntax/gantt.html)
- [x] [~~Pie Chart~~](https://mermaid.js.org/syntax/pie.html)
- [ ] [Quadrant Chart](https://mermaid.js.org/syntax/quadrantChart.html)
- [x] [~~Requirement Diagram~~](https://mermaid.js.org/syntax/requirementDiagram.html)
- [ ] [Gitgraph (Git) Diagram](https://mermaid.js.org/syntax/gitgraph.html)
- [ ] [C4 Diagram 🦺⚠️](https://mermaid.js.org/syntax/c4.html)
- [x] [~~Mindmaps~~](https://mermaid.js.org/syntax/mindmap.html)
- [ ] [Timeline](https://mermaid.js.org/syntax/timeline.html)
- [ ] [Zenuml](https://mermaid.js.org/syntax/zenuml.html)
- [ ] [Sankey](https://mermaid.js.org/syntax/sankey.html)
- [ ] [XYChart 🔥](https://mermaid.js.org/syntax/xyChart.html)
- [ ] [Block Diagram 🔥](https://mermaid.js.org/syntax/block.html)
- [ ] [Packet 🔥](https://mermaid.js.org/syntax/packet.html)
- [ ] [Kanban 🔥](https://mermaid.js.org/syntax/kanban.html)
- [ ] [Architecture 🔥](https://mermaid.js.org/syntax/architecture.html)

## License

This project is licensed under the [MIT License](LICENSE).

## Contact

If you have any questions or want to get in touch, you can reach out to me at [ouhammmourachid@gmail.com](ouhammmourachid@gmail.com).

            

Raw data

            {
    "_id": null,
    "home_page": "https://mermaidpy.vercel.app",
    "name": "mermaid-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "ouhammmourachid",
    "author_email": "rachidouhammou21@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bc/fe/60a9b7db34fe654f1d073c6983f45b03b41eee0002b270d989a0af5df9df/mermaid_py-0.7.1.tar.gz",
    "platform": null,
    "description": "# Mermaid-py\n\nthis package works as an interface for the famous mermaid-js library that uses scripts to create diagrams.\n\n[![Code Coverage](https://codecov.io/gh/ouhammmourachid/mermaid-py/graph/badge.svg?token=732C2PA73Z)](https://codecov.io/gh/ouhammmourachid/mermaid-py)\n[![GitHub LICENSE](https://img.shields.io/github/license/ouhammmourachid/mermaid-py)](https://github.com/ouhammmourachid/mermaid-py/blob/main/LICENSE)\n[![Mounthly Download](https://img.shields.io/pypi/dm/mermaid-py)](https://pypistats.org/packages/mermaid-py)\n[![latest version](https://img.shields.io/pypi/v/mermaid-py.svg?style=flat)](https://pypi.org/project/mermaid-py/)\n[![supported python version](https://img.shields.io/pypi/pyversions/mermaid-py)](https://pypi.org/project/mermaid-py)\n[![ruff badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![mermaid-py on snyk](https://snyk.io/advisor/python/mermaid-py/badge.svg)](https://snyk.io/advisor/python/mermaid-py)\n\n\n## Description\n\nmermaid-py is a dynamic Python library designed to serve as a seamless interface for\nthe renowned Mermaid library. Built upon the powerful capabilities of Python, mermaid-py\nempowers developers and data enthusiasts to effortlessly create stunning diagrams, flowcharts,\nand visualizations directly within their Python environments.\n\n\n## Examples\n\nfirst install the package using pip:\n\n```bash\npip install mermaid-py\n```\n\n- using `Mermaid` and `Graph` classes:\n```python\nimport mermaid as md\nfrom mermaid.graph import Graph\n\nsequence = Graph('Sequence-diagram',\"\"\"\nstateDiagram-v2\n    [*] --> Still\n    Still --> [*]\n\n    Still --> Moving\n    Moving --> Still\n    Moving --> Crash\n    Crash --> [*]\n\"\"\")\nrender = md.Mermaid(sequence)\nrender # !! note this only works in the notebook that rendered the html.\n```\n\n<p align=\"center\">\n   <img src=\"https://github.com/user-attachments/assets/8476ec24-b41f-4a88-9c30-a2478a2c0fd8\" alt=\"Example Flowchart\"\n    style=\"width: 20%;\">\n</p>\n\n- using `mermaidjs` magic function in a notebook first `import mermaid as md`:\n\n```python\n%%mermaidjs # with --img flag in case your notebook doesn't render HTML\nflowchart LR\n    A-->B\n    B-->C\n```\n\n<p align=\"center\">\n    <img src=\"https://github.com/ouhammmourachid/mermaid-py/assets/93659459/d4d1b993-a33d-4eb0-82ae-2ad39bf30e90\" alt=\"Example Flowchart\"\n    style=\"width: 20%;\">\n</p>\n\n- using `FlowChart` etc ...\n\n```python\nfrom mermaid import *\nfrom mermaid.flowchart import *\n\ndiagram = Mermaid(Flowchart(...))\n\ndiagram\n```\n- more examples on [mermaid](https://www.kaggle.com/code/ouhammourachid/mermaid-py) and [test-mermaid](https://www.kaggle.com/code/ouhammourachid/testing-mermaid-py)\n\n## Server\n\nBy default, the library uses the mermaid.ink service [github](https://github.com/jihchi/mermaid.ink) for generating diagrams. The service can be run locally using docker, following instructions [here](https://github.com/jihchi/mermaid.ink?tab=readme-ov-file#launch-a-container).\n\nThe `MERMAID_INK_SERVER` environment variable can be used to specify the server to use, for example.\n\n## List of Diagrames\n- [x] [~~FlowChart~~](https://mermaid.js.org/syntax/flowchart.html)\n- [x] [~~Sequence Diagram~~](https://mermaid.js.org/syntax/sequenceDiagram.html)\n- [ ] [Class Diagram](https://mermaid.js.org/syntax/classDiagram.html)\n- [x] [~~State Diagram~~](https://mermaid.js.org/syntax/stateDiagram.html)\n- [x] [~~Entity Relationship Diagram~~](https://mermaid.js.org/syntax/entityRelationshipDiagram.html)\n- [x] [~~User Journey~~](https://mermaid.js.org/syntax/userJourney.html)\n- [ ] [Gantt](https://mermaid.js.org/syntax/gantt.html)\n- [x] [~~Pie Chart~~](https://mermaid.js.org/syntax/pie.html)\n- [ ] [Quadrant Chart](https://mermaid.js.org/syntax/quadrantChart.html)\n- [x] [~~Requirement Diagram~~](https://mermaid.js.org/syntax/requirementDiagram.html)\n- [ ] [Gitgraph (Git) Diagram](https://mermaid.js.org/syntax/gitgraph.html)\n- [ ] [C4 Diagram \ud83e\uddba\u26a0\ufe0f](https://mermaid.js.org/syntax/c4.html)\n- [x] [~~Mindmaps~~](https://mermaid.js.org/syntax/mindmap.html)\n- [ ] [Timeline](https://mermaid.js.org/syntax/timeline.html)\n- [ ] [Zenuml](https://mermaid.js.org/syntax/zenuml.html)\n- [ ] [Sankey](https://mermaid.js.org/syntax/sankey.html)\n- [ ] [XYChart \ud83d\udd25](https://mermaid.js.org/syntax/xyChart.html)\n- [ ] [Block Diagram \ud83d\udd25](https://mermaid.js.org/syntax/block.html)\n- [ ] [Packet \ud83d\udd25](https://mermaid.js.org/syntax/packet.html)\n- [ ] [Kanban \ud83d\udd25](https://mermaid.js.org/syntax/kanban.html)\n- [ ] [Architecture \ud83d\udd25](https://mermaid.js.org/syntax/architecture.html)\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Contact\n\nIf you have any questions or want to get in touch, you can reach out to me at [ouhammmourachid@gmail.com](ouhammmourachid@gmail.com).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Interface for the Popular mermaid-js Library, Simplified for Diagram Creation.",
    "version": "0.7.1",
    "project_urls": {
        "Homepage": "https://mermaidpy.vercel.app",
        "Repository": "https://github.com/ouhammmourachid/mermaid-py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db8434373bd2aab59f8435081867f6ce2cce3b6c903285fac9b1c6434128c993",
                "md5": "4ffe16c3dcdc0c7b02ee996a1183608a",
                "sha256": "82dde881f98d40023dea728c76bd2f89a7f5ed6abe8af9374b6385883d2d1066"
            },
            "downloads": -1,
            "filename": "mermaid_py-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4ffe16c3dcdc0c7b02ee996a1183608a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 31735,
            "upload_time": "2025-02-23T08:34:07",
            "upload_time_iso_8601": "2025-02-23T08:34:07.377113Z",
            "url": "https://files.pythonhosted.org/packages/db/84/34373bd2aab59f8435081867f6ce2cce3b6c903285fac9b1c6434128c993/mermaid_py-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bcfe60a9b7db34fe654f1d073c6983f45b03b41eee0002b270d989a0af5df9df",
                "md5": "6d583aa7e1a36446460e1ea561968b69",
                "sha256": "c4c23c4777a528f5e94d2788dfc7acccc94c9ff8bd86d6b7f44974ac4ce99821"
            },
            "downloads": -1,
            "filename": "mermaid_py-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6d583aa7e1a36446460e1ea561968b69",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 21246,
            "upload_time": "2025-02-23T08:34:08",
            "upload_time_iso_8601": "2025-02-23T08:34:08.820091Z",
            "url": "https://files.pythonhosted.org/packages/bc/fe/60a9b7db34fe654f1d073c6983f45b03b41eee0002b270d989a0af5df9df/mermaid_py-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-23 08:34:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ouhammmourachid",
    "github_project": "mermaid-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mermaid-py"
}
        
Elapsed time: 0.92981s