Skip to content

Commit 324d4ac

Browse files
authored
feat: Replace graphviz and asciinet by mermaid and mermaid-ascii (#283)
1 parent 9ef4dd0 commit 324d4ac

24 files changed

+2034
-1880
lines changed

B

Whitespace-only changes.

conda/dev.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ channels:
33
- nodefaults
44
- conda-forge
55
dependencies:
6-
- graphviz
7-
- openjdk # java is required by asciinet
86
- python
97
- poetry >=2
108
- nodejs # used by semantic-release

conda/release.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ channels:
33
- nodefaults
44
- conda-forge
55
dependencies:
6-
- graphviz
7-
- python >=3.9,<3.13
8-
- openjdk
6+
- python >=3.9,<3.14
97
- poetry >=2
108
- nodejs >=18.17 # used by semantic-release
119
- shellcheck

docs/tutorials/context.ipynb

Lines changed: 107 additions & 9 deletions
Large diffs are not rendered by default.

docs/tutorials/fibonacci.ipynb

Lines changed: 56 additions & 5 deletions
Large diffs are not rendered by default.

docs/tutorials/for-loop.ipynb

Lines changed: 59 additions & 9 deletions
Large diffs are not rendered by default.

docs/tutorials/functions.ipynb

Lines changed: 87 additions & 9 deletions
Large diffs are not rendered by default.

docs/tutorials/get-started.ipynb

Lines changed: 232 additions & 144 deletions
Large diffs are not rendered by default.

libs/astx/pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ license = "BSD 3 Clause"
1010
requires-python = ">=3.9,<4"
1111
dependencies = [
1212
"atpublic >= 4.0",
13-
"graphviz >= 0.20.1",
14-
"asciinet >= 0.3.1",
15-
"msgpack >= 1",
1613
"plum-dispatch >= 2",
1714
"typeguard >= 4",
1815
"typing-extensions >=4 ; python_version < '3.9'",
1916
"eval-type-backport >=0.2 ; python_version < '3.10'",
17+
"mermaid-ascii (>=0.6.1)",
2018
]
2119

2220

libs/astx/src/astx/base.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,14 @@ def __str__(self) -> str:
249249

250250
def __repr__(self) -> str:
251251
"""Return an string that represents the object."""
252-
if not is_using_jupyter_notebook():
253-
from astx.viz import graph_to_ascii, traverse_ast_ascii
252+
if is_using_jupyter_notebook():
253+
return ""
254254

255-
graph = traverse_ast_ascii(self.get_struct(simplified=True))
256-
return graph_to_ascii(graph)
257-
return ""
255+
from astx.viz import visualize_ascii
256+
257+
result = visualize_ascii(self.get_struct())
258+
259+
return result
258260

259261
def _repr_png_(self) -> None:
260262
"""
@@ -264,9 +266,9 @@ def _repr_png_(self) -> None:
264266
a Graphviz diagram inline.
265267
"""
266268
# importing it here in order to avoid cyclic import issue
267-
from astx.viz import visualize
269+
from astx.viz import visualize_image
268270

269-
visualize(self.get_struct(simplified=False))
271+
visualize_image(self.get_struct(simplified=False))
270272

271273
def _update_parent(self) -> None:
272274
"""Update the parent node."""

0 commit comments

Comments
 (0)