Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/coverage-7.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ouhammmourachid authored Aug 10, 2024
2 parents 18b4c3b + f3ba028 commit e65f740
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 32 deletions.
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# variables
POETRY_RUN = poetry run
PRE_COMMIT_CMD = $(POETRY_RUN) pre-commit
POETRY_RUN := poetry run
PRE_COMMIT_CMD := $(POETRY_RUN) pre-commit

.PHONY: install
install:
Expand Down Expand Up @@ -42,3 +42,21 @@ bumpversion:
$(POETRY_RUN) bumpver update --$(name)
%:
@:

.PHONY: help
help:
@echo "run 'make <target>' where <target> is one of the following:"
@echo ""
@echo " install install dependencies"
@echo " update update dependencies"
@echo " build build package"
@echo " publish publish package"
@echo ""
@echo " test run tests"
@echo " install-pre-commit install pre-commit hooks"
@echo " lint run linters"
@echo " coverage run tests with coverage"
@echo ""
@echo " bumpversion bump version"
@echo " help show this help message"
@echo ""
51 changes: 21 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,35 @@ and visualizations directly within their Python environments.


## Examples
first install `mermaid-py` by `pip install mermaid-py`.

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

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]
sequence = Graph('Sequence-diagram',"""
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
""")
graphe: md.Mermaid = md.Mermaid(graph)
graphe # !! note this only works in the notebook that rendered the html.
render = md.Mermaid(sequence)
render # !! note this only works in the notebook that rendered the html.
```
the result will be like this

<p align="center">
<img src="https://github.com/ouhammmourachid/mermaid-py/assets/93659459/e20f353a-135d-4aa2-bb91-04bedeee36a0" alt="Example Flowchart"
style="width: 30%;">
<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`:
Expand All @@ -67,11 +74,10 @@ flowchart LR
A-->B
B-->C
```
the result:

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

- using `FlowChart` etc ...
Expand All @@ -87,21 +93,6 @@ 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)


## Technologies Used

- Python3
- Poetry

## To contribute to `mermaid-py`

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

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

## List of Diagrames
- [x] [~~FlowChart~~](https://mermaid.js.org/syntax/flowchart.html)
Expand Down

0 comments on commit e65f740

Please sign in to comment.