https://github.com/ouhammmourachid/mermaid-py
Python Interface for the Popular mermaid-js Library, Simplified for Diagram Creation
https://github.com/ouhammmourachid/mermaid-py
mermaid-diagrams open-source poetry pypi-package python3
Last synced: 5 months ago
JSON representation
Python Interface for the Popular mermaid-js Library, Simplified for Diagram Creation
- Host: GitHub
- URL: https://github.com/ouhammmourachid/mermaid-py
- Owner: ouhammmourachid
- License: mit
- Created: 2023-10-23T09:47:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-18T23:15:33.000Z (5 months ago)
- Last Synced: 2024-11-19T00:23:33.104Z (5 months ago)
- Topics: mermaid-diagrams, open-source, poetry, pypi-package, python3
- Language: Python
- Homepage: https://mermaidpy.vercel.app
- Size: 1.52 MB
- Stars: 58
- Watchers: 2
- Forks: 6
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# Mermaid-py
this package works as an interface for the famous mermaid-js library that uses scripts to create diagrams.
[](https://codecov.io/gh/ouhammmourachid/mermaid-py)
[](https://github.com/ouhammmourachid/mermaid-py/blob/main/LICENSE)
[](https://pypistats.org/packages/mermaid-py)
[](https://pypi.org/project/mermaid-py/)
[](https://pypi.org/project/mermaid-py)
[](https://github.com/astral-sh/ruff)
[](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 Graphsequence = 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.
```
![]()
- 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
```
![]()
- 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)## 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)
- [ ] [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 [[email protected]]([email protected]).