py2dag 0.3.8__py3-none-any.whl → 0.3.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2dag/parser.py +13 -9
- {py2dag-0.3.8.dist-info → py2dag-0.3.10.dist-info}/METADATA +14 -5
- py2dag-0.3.10.dist-info/RECORD +12 -0
- py2dag-0.3.8.dist-info/RECORD +0 -12
- {py2dag-0.3.8.dist-info → py2dag-0.3.10.dist-info}/LICENSE +0 -0
- {py2dag-0.3.8.dist-info → py2dag-0.3.10.dist-info}/WHEEL +0 -0
- {py2dag-0.3.8.dist-info → py2dag-0.3.10.dist-info}/entry_points.txt +0 -0
py2dag/parser.py
CHANGED
@@ -509,15 +509,19 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
|
|
509
509
|
})
|
510
510
|
returned_var = const_id
|
511
511
|
elif isinstance(stmt.value, (ast.Constant, ast.List, ast.Tuple, ast.Dict)):
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
"
|
516
|
-
|
517
|
-
"
|
518
|
-
|
519
|
-
|
520
|
-
|
512
|
+
try:
|
513
|
+
lit = _literal(stmt.value)
|
514
|
+
except DSLParseError:
|
515
|
+
returned_var = _emit_assign_from_literal_or_pack("return_value", stmt.value)
|
516
|
+
else:
|
517
|
+
const_id = _ssa_new("return_value")
|
518
|
+
ops.append({
|
519
|
+
"id": const_id,
|
520
|
+
"op": "CONST.value",
|
521
|
+
"deps": [],
|
522
|
+
"args": {"value": lit},
|
523
|
+
})
|
524
|
+
returned_var = const_id
|
521
525
|
else:
|
522
526
|
raise DSLParseError("return must return a variable name or literal")
|
523
527
|
return None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: py2dag
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.10
|
4
4
|
Summary: Convert Python function plans to DAG (JSON, pseudo, optional SVG).
|
5
5
|
License: MIT
|
6
6
|
Author: rvergis
|
@@ -18,7 +18,16 @@ Requires-Dist: graphviz (>=0.20.3,<0.21.0) ; extra == "svg"
|
|
18
18
|
Description-Content-Type: text/markdown
|
19
19
|
|
20
20
|
# py2dag
|
21
|
-
Convert Python function plans to a DAG (JSON, pseudo, optional SVG).
|
21
|
+
Convert Python function plans to a DAG (JSON, pseudo, optional HTML/SVG).
|
22
|
+
|
23
|
+
## Features
|
24
|
+
|
25
|
+
- Writes `plan.json` with explicit `nodes` and `edges` for downstream tools.
|
26
|
+
- Generates human-readable pseudo code at `plan.pseudo`.
|
27
|
+
- Optional exports:
|
28
|
+
- `--html` for an interactive Dagre graph with color-coded nodes.
|
29
|
+
- `--svg` for a Graphviz-rendered SVG.
|
30
|
+
- Node colors are chosen deterministically so the same op type is colored consistently across runs.
|
22
31
|
|
23
32
|
## Install
|
24
33
|
|
@@ -64,17 +73,17 @@ make run FILE=path/to/your_file.py ARGS=--html
|
|
64
73
|
- Run the installed CLI (after `pip install py2dag`):
|
65
74
|
|
66
75
|
```
|
67
|
-
py2dag path/to/your_file.py --html
|
76
|
+
py2dag path/to/your_file.py --html # interactive HTML
|
77
|
+
py2dag path/to/your_file.py --svg # Graphviz SVG
|
68
78
|
```
|
69
79
|
|
70
|
-
|
71
80
|
- Or directly with Python (inside venv):
|
72
81
|
|
73
82
|
```
|
74
83
|
poetry run python cli.py path/to/your_file.py --html
|
75
84
|
```
|
76
85
|
|
77
|
-
This generates `plan.json`, `plan.pseudo`, and if `--html` is used, `plan.html`.
|
86
|
+
This generates `plan.json`, `plan.pseudo`, and if `--html`/`--svg` is used, `plan.html` or `plan.svg`.
|
78
87
|
|
79
88
|
- Function name: By default the tool auto-detects a suitable function in the file. To target a specific function, pass `--func NAME`.
|
80
89
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
py2dag/__init__.py,sha256=i8VB44JCVcRJAcvnQtbH8YVRUz5j7dE355iRbikXPGQ,250
|
2
|
+
py2dag/cli.py,sha256=q8ocafpGtkrls1mx9QiFU1wL6KKeeJhT0Oklk6SwHB0,15151
|
3
|
+
py2dag/colors.py,sha256=kVMVWUKJY1uLQFQux5XKiEcofDFpNPQoAEzpMJWs2b0,604
|
4
|
+
py2dag/export_dagre.py,sha256=Og-oVjKzc7bRgeU7rgLHDjiY6wIcNyr2nIYlSAQzKoM,6041
|
5
|
+
py2dag/export_svg.py,sha256=3ZmZqxIUidSbuKIIh5kFqhfVnoqZ6PbEQpMih4AX9xo,3793
|
6
|
+
py2dag/parser.py,sha256=9UwUxarXmLXYyiEf2xg2gxcAurhwG9kG6bKbh0FcEFU,37256
|
7
|
+
py2dag/pseudo.py,sha256=NJK61slyFLtSjhj8gJDJneUInEpBN57_41g8IfHNPWI,922
|
8
|
+
py2dag-0.3.10.dist-info/LICENSE,sha256=3Qee1EPwej_nusovTbyIQ8LvD2rXHdM0c6LNwk_D8Kc,1067
|
9
|
+
py2dag-0.3.10.dist-info/METADATA,sha256=DIOEg22N1JL5m_foB-gdYMxvxytX8yMU54O6HpQuHMA,4024
|
10
|
+
py2dag-0.3.10.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
11
|
+
py2dag-0.3.10.dist-info/entry_points.txt,sha256=Q0SHexJJ0z1te4AYL1xTZogx5FrxCCE1ZJ5qntkFMZs,42
|
12
|
+
py2dag-0.3.10.dist-info/RECORD,,
|
py2dag-0.3.8.dist-info/RECORD
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
py2dag/__init__.py,sha256=i8VB44JCVcRJAcvnQtbH8YVRUz5j7dE355iRbikXPGQ,250
|
2
|
-
py2dag/cli.py,sha256=q8ocafpGtkrls1mx9QiFU1wL6KKeeJhT0Oklk6SwHB0,15151
|
3
|
-
py2dag/colors.py,sha256=kVMVWUKJY1uLQFQux5XKiEcofDFpNPQoAEzpMJWs2b0,604
|
4
|
-
py2dag/export_dagre.py,sha256=Og-oVjKzc7bRgeU7rgLHDjiY6wIcNyr2nIYlSAQzKoM,6041
|
5
|
-
py2dag/export_svg.py,sha256=3ZmZqxIUidSbuKIIh5kFqhfVnoqZ6PbEQpMih4AX9xo,3793
|
6
|
-
py2dag/parser.py,sha256=WKLT-2qYpcGvlwU9hQ7o9wIFIxU328mlp8ntaAai5KY,37026
|
7
|
-
py2dag/pseudo.py,sha256=NJK61slyFLtSjhj8gJDJneUInEpBN57_41g8IfHNPWI,922
|
8
|
-
py2dag-0.3.8.dist-info/LICENSE,sha256=3Qee1EPwej_nusovTbyIQ8LvD2rXHdM0c6LNwk_D8Kc,1067
|
9
|
-
py2dag-0.3.8.dist-info/METADATA,sha256=nDc9Jce8EqZbUy3vum4zOwJJ20We7geFRYKfFGyMbSE,3549
|
10
|
-
py2dag-0.3.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
11
|
-
py2dag-0.3.8.dist-info/entry_points.txt,sha256=Q0SHexJJ0z1te4AYL1xTZogx5FrxCCE1ZJ5qntkFMZs,42
|
12
|
-
py2dag-0.3.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|