jpipe-runner 2.0.0b27__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Jason Lyu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.3
2
+ Name: jpipe-runner
3
+ Version: 2.0.0b27
4
+ Summary: A Justification Runner designed for jPipe.
5
+ License: MIT
6
+ Keywords: justification,pipeline,ML,AI
7
+ Author: Jason Lyu
8
+ Author-email: xjasonlyu@gmail.com
9
+ Requires-Python: >=3.11
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Provides-Extra: docs
17
+ Provides-Extra: full
18
+ Provides-Extra: gui
19
+ Requires-Dist: matplotlib (==3.10.5) ; extra == "gui" or extra == "full"
20
+ Requires-Dist: networkx (==3.5)
21
+ Requires-Dist: pygraphviz (==1.14)
22
+ Requires-Dist: pyyaml (==6.0.2)
23
+ Requires-Dist: sphinx (==8.1.3) ; extra == "docs" or extra == "full"
24
+ Project-URL: Homepage, https://github.com/jpipe-mcscert/jpipe-runner
25
+ Description-Content-Type: text/markdown
26
+
27
+ # jPipe Runner
28
+
29
+ ```text
30
+ _ ____ _ ____
31
+ (_) _ \(_)_ __ ___ | _ \ _ _ _ __ _ __ ___ _ __
32
+ | | |_) | | '_ \ / _ \ | |_) | | | | '_ \| '_ \ / _ \ '__|
33
+ | | __/| | |_) | __/ | _ <| |_| | | | | | | | __/ |
34
+ _/ |_| |_| .__/ \___| |_| \_\\__,_|_| |_|_| |_|\___|_|
35
+ |__/ |_|
36
+ ```
37
+
38
+ A Justification Runner designed for jPipe.
39
+
40
+ ## 🚀 Usage
41
+
42
+ ### CLI
43
+
44
+ ```bash
45
+ poetry run jpipe-runner [-h] [--variable NAME:VALUE] [--library LIB] \
46
+ [--diagram PATTERN] [--output FILE] [--dry-run] \
47
+ [--verbose] [--config-file PATH] [--gui] jd_file
48
+ ```
49
+
50
+ **Key options:**
51
+
52
+ * `--variable`, `-v`: Define `NAME:VALUE` pairs for template variables.
53
+ * `--library`, `-l`: Load additional Python modules (steps).
54
+ * `--diagram`, `-d`: Select diagrams by wildcard pattern.
55
+ * `--output`, `-o`: Specify output image file (format inferred by extension).
56
+ * `--dry-run`: Validate workflow without executing.
57
+ * `--verbose`, `-V`: Enable debug logging.
58
+ * `--config-file`: Load workflow config from a YAML file.
59
+ * `--gui`: Launch the Tkinter-based `GraphWorkflowVisualizer`
60
+
61
+ Example:
62
+
63
+ ```bash
64
+ poetry run jpipe-runner --variable X:10 --diagram "flow*" \
65
+ --output diagram.png workflow.jd
66
+ ```
67
+
68
+ For detailed instructions on how to execute the project, including descriptions of all CLI parameters and usage examples, see the [Usage Guide](docs/USAGE.md).
69
+
70
+ ## ⚙️Installation
71
+
72
+ ### Prerequisites
73
+
74
+ * Python 3.10+
75
+ * [Poetry](https://python-poetry.org)
76
+ * [Graphviz](https://graphviz.org/) (`libgraphviz-dev`, `pkg-config`)
77
+ * Optional for GUI version: [Tkinter](https://docs.python.org/3/library/tkinter.html)
78
+
79
+ ### From Source
80
+
81
+ ```bash
82
+ # Lock and install dependencies
83
+ poetry lock
84
+ poetry install
85
+ ```
86
+
87
+ ### Build Package
88
+
89
+ ```bash
90
+ # Run tests
91
+ poetry run pytest
92
+
93
+ # Build distributable
94
+ poetry build
95
+ ```
96
+
97
+ ## 📚 Learn More
98
+
99
+ * [Usage Guide](docs/USAGE.md)
100
+ * [Packaging & CI/CD](docs/PACKAGING_RELEASE.md)
101
+ * [Troubleshooting](docs/TROUBLESHOOTING.md)
102
+ * [Developer Docs (Sphinx)](docs/BUILD_DOCS.md)
103
+ * [Contributing](docs/CONTRIBUTING.md)
104
+
105
+ ## 📄 License
106
+
107
+ MIT License — see [LICENSE](LICENSE).
108
+
109
+ ## 👤 Authors
110
+
111
+ * [Jason Lyu](https://github.com/xjasonlyu)
112
+ * [Baptiste Lacroix](https://github.com/BaptisteLacroix)
113
+ * [Sébastien Mosser](https://github.com/mosser)
114
+
115
+ ## How to cite?
116
+
117
+ ```bibtex
118
+ @software{mcscert:jpipe-runner,
119
+ author = {Mosser, Sébastien and Lyu, Jason and Lacroix, Baptiste},
120
+ license = {MIT},
121
+ title = {{jPipe Runner}},
122
+ url = {https://github.com/ace-design/jpipe-runner}
123
+ }
124
+ ```
125
+
126
+ ## Contact Us
127
+
128
+ If you're interested in contributing to the research effort related to jPipe projects, feel free to contact the PI:
129
+
130
+ - [Dr. Sébastien Mosser](mailto:mossers@mcmaster.ca)
131
+
@@ -0,0 +1,104 @@
1
+ # jPipe Runner
2
+
3
+ ```text
4
+ _ ____ _ ____
5
+ (_) _ \(_)_ __ ___ | _ \ _ _ _ __ _ __ ___ _ __
6
+ | | |_) | | '_ \ / _ \ | |_) | | | | '_ \| '_ \ / _ \ '__|
7
+ | | __/| | |_) | __/ | _ <| |_| | | | | | | | __/ |
8
+ _/ |_| |_| .__/ \___| |_| \_\\__,_|_| |_|_| |_|\___|_|
9
+ |__/ |_|
10
+ ```
11
+
12
+ A Justification Runner designed for jPipe.
13
+
14
+ ## 🚀 Usage
15
+
16
+ ### CLI
17
+
18
+ ```bash
19
+ poetry run jpipe-runner [-h] [--variable NAME:VALUE] [--library LIB] \
20
+ [--diagram PATTERN] [--output FILE] [--dry-run] \
21
+ [--verbose] [--config-file PATH] [--gui] jd_file
22
+ ```
23
+
24
+ **Key options:**
25
+
26
+ * `--variable`, `-v`: Define `NAME:VALUE` pairs for template variables.
27
+ * `--library`, `-l`: Load additional Python modules (steps).
28
+ * `--diagram`, `-d`: Select diagrams by wildcard pattern.
29
+ * `--output`, `-o`: Specify output image file (format inferred by extension).
30
+ * `--dry-run`: Validate workflow without executing.
31
+ * `--verbose`, `-V`: Enable debug logging.
32
+ * `--config-file`: Load workflow config from a YAML file.
33
+ * `--gui`: Launch the Tkinter-based `GraphWorkflowVisualizer`
34
+
35
+ Example:
36
+
37
+ ```bash
38
+ poetry run jpipe-runner --variable X:10 --diagram "flow*" \
39
+ --output diagram.png workflow.jd
40
+ ```
41
+
42
+ For detailed instructions on how to execute the project, including descriptions of all CLI parameters and usage examples, see the [Usage Guide](docs/USAGE.md).
43
+
44
+ ## ⚙️Installation
45
+
46
+ ### Prerequisites
47
+
48
+ * Python 3.10+
49
+ * [Poetry](https://python-poetry.org)
50
+ * [Graphviz](https://graphviz.org/) (`libgraphviz-dev`, `pkg-config`)
51
+ * Optional for GUI version: [Tkinter](https://docs.python.org/3/library/tkinter.html)
52
+
53
+ ### From Source
54
+
55
+ ```bash
56
+ # Lock and install dependencies
57
+ poetry lock
58
+ poetry install
59
+ ```
60
+
61
+ ### Build Package
62
+
63
+ ```bash
64
+ # Run tests
65
+ poetry run pytest
66
+
67
+ # Build distributable
68
+ poetry build
69
+ ```
70
+
71
+ ## 📚 Learn More
72
+
73
+ * [Usage Guide](docs/USAGE.md)
74
+ * [Packaging & CI/CD](docs/PACKAGING_RELEASE.md)
75
+ * [Troubleshooting](docs/TROUBLESHOOTING.md)
76
+ * [Developer Docs (Sphinx)](docs/BUILD_DOCS.md)
77
+ * [Contributing](docs/CONTRIBUTING.md)
78
+
79
+ ## 📄 License
80
+
81
+ MIT License — see [LICENSE](LICENSE).
82
+
83
+ ## 👤 Authors
84
+
85
+ * [Jason Lyu](https://github.com/xjasonlyu)
86
+ * [Baptiste Lacroix](https://github.com/BaptisteLacroix)
87
+ * [Sébastien Mosser](https://github.com/mosser)
88
+
89
+ ## How to cite?
90
+
91
+ ```bibtex
92
+ @software{mcscert:jpipe-runner,
93
+ author = {Mosser, Sébastien and Lyu, Jason and Lacroix, Baptiste},
94
+ license = {MIT},
95
+ title = {{jPipe Runner}},
96
+ url = {https://github.com/ace-design/jpipe-runner}
97
+ }
98
+ ```
99
+
100
+ ## Contact Us
101
+
102
+ If you're interested in contributing to the research effort related to jPipe projects, feel free to contact the PI:
103
+
104
+ - [Dr. Sébastien Mosser](mailto:mossers@mcmaster.ca)
@@ -0,0 +1,48 @@
1
+ [tool.poetry]
2
+ name = "jpipe-runner"
3
+ version = "2.0.0b27"
4
+ description = "A Justification Runner designed for jPipe."
5
+ authors = [
6
+ "Jason Lyu <xjasonlyu@gmail.com>",
7
+ "Sébastien Mosser <mossers@mcmaster.ca>",
8
+ "Baptiste Lacroix <contact@baptiste-lacroix.fr>"
9
+ ]
10
+ readme = "README.md"
11
+ license = "MIT"
12
+ homepage = "https://github.com/jpipe-mcscert/jpipe-runner"
13
+ keywords = ["justification", "pipeline", "ML", "AI"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent"
17
+ ]
18
+ packages = [
19
+ { include = "jpipe_runner", from = "src" }
20
+ ]
21
+
22
+ [tool.poetry.dependencies]
23
+ python = ">=3.11"
24
+ networkx = "3.5"
25
+ pygraphviz = "1.14"
26
+ pyyaml = "6.0.2"
27
+
28
+ matplotlib = { version = "3.10.5", optional = true }
29
+ sphinx = { version = "8.1.3", optional = true }
30
+
31
+ [tool.poetry.extras]
32
+ gui = ["matplotlib"]
33
+ docs = ["sphinx"]
34
+ full = ["matplotlib", "sphinx"]
35
+
36
+ [tool.poetry.scripts]
37
+ jpipe-runner = "jpipe_runner.runner:main"
38
+
39
+ [tool.poetry.group.dev.dependencies]
40
+ pytest = "^8.4.1"
41
+ pytest-mock = "^3.14.1"
42
+
43
+ [tool.poetry.requires-plugins]
44
+ poetry-plugin-export = ">=1.8"
45
+
46
+ [build-system]
47
+ requires = ["poetry-core"]
48
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,284 @@
1
+ import networkx as nx
2
+
3
+ try:
4
+ import tkinter as tk
5
+ import matplotlib.pyplot as plt
6
+ from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
7
+ from matplotlib.patches import Patch
8
+ GUI_AVAILABLE = True
9
+ except ImportError:
10
+ GUI_AVAILABLE = False
11
+ tk = None
12
+ plt = None
13
+
14
+
15
+ class GraphWorkflowVisualizer:
16
+ # Workflow steps
17
+ PARSE_CLI_ARGS = "Parse CLI arguments"
18
+ SET_LOGGER_LEVEL = "Set logger level"
19
+ INITIALIZE_RUNTIME = "Initialize runtime"
20
+ VALIDATE_ARGUMENTS_FILES = "Validate arguments files"
21
+ VALIDATE_JUSTIFICATION_FILE = "Validate justification file"
22
+ LOAD_CONFIGURATION = "Load configuration"
23
+ LOAD_JUSTIFICATION_FILE = "Load justification file"
24
+ PARSE_JUSTIFICATION_GRAPH = "Parse justification graph"
25
+ REGISTER_DECORATORS = "Register decorators"
26
+ VALIDATE_PIPELINE = "Validate pipeline"
27
+ EXECUTE_JUSTIFICATION = "Execute justification"
28
+ SUMMARIZE_RESULTS = "Summarize results"
29
+ EXPORT_OUTPUT = "Export output"
30
+
31
+ # Substeps VALIDATE_JUSTIFICATION_FILE
32
+ VALIDATE_STRUCTURE_ELEMENTS = "Validate structure of elements"
33
+ VALIDATE_RELATIONS_STRUCTURES = "Validate relations structure"
34
+ EXTRACTING_JUSTIFICATION_NAME = "Extracting justification name"
35
+
36
+ # PARSE_JUSTIFICATION_GRAPH
37
+ ADDING_NODE_TO_GRAPH = "Adding node to graph"
38
+ ADDING_EDGES_TO_GRAPH = "Adding edges to graph"
39
+
40
+ # EXECUTE_JUSTIFICATION
41
+ FETCH_EXECUTION_ORDER = "Fetch execution order"
42
+ CALL_FUNCTION = "Call function"
43
+ CHECK_RETURN_TYPE = "Check return type"
44
+ HANDLE_RESULT_STATUS = "Handle result status"
45
+
46
+ # EXPORT_OUTPUT
47
+ IMPORTING_PYGRAPHVIZ = "Importing pygraphviz"
48
+ PREPARE_OUTPUT_PATH = "Prepare output path"
49
+ PREPARE_STYLES = "Prepare styles"
50
+ CREATE_GRAPH = "Create graph"
51
+ STYLE_NODES = "Style nodes"
52
+ STYLE_EDGES = "Style edges"
53
+ DRAW_GRAPH = "Draw graph"
54
+
55
+ # Statuses
56
+ CURRENT = "current"
57
+ DONE = "done"
58
+ FAIL = "fail"
59
+ IDLE = "idle"
60
+ SKIP = "skip"
61
+
62
+ # Modes
63
+ GRAPH = "graph"
64
+ DETAIL = "detail"
65
+
66
+ workflow_nodes = [
67
+ PARSE_CLI_ARGS,
68
+ SET_LOGGER_LEVEL,
69
+ INITIALIZE_RUNTIME,
70
+ VALIDATE_ARGUMENTS_FILES,
71
+ VALIDATE_JUSTIFICATION_FILE,
72
+ LOAD_CONFIGURATION,
73
+ LOAD_JUSTIFICATION_FILE,
74
+ PARSE_JUSTIFICATION_GRAPH,
75
+ REGISTER_DECORATORS,
76
+ VALIDATE_PIPELINE,
77
+ EXECUTE_JUSTIFICATION,
78
+ SUMMARIZE_RESULTS,
79
+ EXPORT_OUTPUT
80
+ ]
81
+
82
+ workflow_edges = [
83
+ (PARSE_CLI_ARGS, SET_LOGGER_LEVEL),
84
+ (SET_LOGGER_LEVEL, VALIDATE_ARGUMENTS_FILES),
85
+ (VALIDATE_ARGUMENTS_FILES, INITIALIZE_RUNTIME),
86
+ (INITIALIZE_RUNTIME, LOAD_CONFIGURATION),
87
+ (LOAD_CONFIGURATION, LOAD_JUSTIFICATION_FILE),
88
+ (LOAD_JUSTIFICATION_FILE, VALIDATE_JUSTIFICATION_FILE),
89
+ (VALIDATE_JUSTIFICATION_FILE, PARSE_JUSTIFICATION_GRAPH),
90
+ (PARSE_JUSTIFICATION_GRAPH, REGISTER_DECORATORS),
91
+ (REGISTER_DECORATORS, VALIDATE_PIPELINE),
92
+ (VALIDATE_PIPELINE, EXECUTE_JUSTIFICATION),
93
+ (EXECUTE_JUSTIFICATION, SUMMARIZE_RESULTS),
94
+ (SUMMARIZE_RESULTS, EXPORT_OUTPUT)
95
+ ]
96
+
97
+ color_map = {
98
+ IDLE: "lightgray",
99
+ CURRENT: "#1E90FF",
100
+ DONE: "limegreen",
101
+ FAIL: "red",
102
+ SKIP: "gold"
103
+ }
104
+
105
+ def __init__(self, master):
106
+ if not GUI_AVAILABLE:
107
+ raise ImportError("GUI dependencies not available. Install with: pip install jpipe-runner[gui]")
108
+ print("Initializing GraphWorkflowVisualizer...")
109
+ self.master = master
110
+ self.master.title("Project Workflow Graph")
111
+ self.mode = GraphWorkflowVisualizer.GRAPH
112
+ self.current_node = None
113
+ self.current_path = []
114
+
115
+ self.G = nx.DiGraph()
116
+ self.G.add_nodes_from(GraphWorkflowVisualizer.workflow_nodes)
117
+ self.G.add_edges_from(GraphWorkflowVisualizer.workflow_edges)
118
+ self.pos = nx.spring_layout(self.G, seed=42, k=0.25)
119
+
120
+ self.fig, self.ax = plt.subplots(figsize=(9, 6))
121
+ self.canvas = FigureCanvasTkAgg(self.fig, master=self.master)
122
+ self.canvas.get_tk_widget().pack(fill=tk.BOTH, expand=True)
123
+
124
+ self.status = {node: GraphWorkflowVisualizer.IDLE for node in GraphWorkflowVisualizer.workflow_nodes}
125
+ self.subgraphs = {}
126
+ self.substatus = {}
127
+ self.subgraph_nodes = {}
128
+
129
+ self.master.protocol("WM_DELETE_WINDOW", self.on_close)
130
+
131
+ self.fig.canvas.mpl_connect("button_press_event", self.on_click)
132
+ self.master.bind("<Escape>", lambda e: self.back_one_level())
133
+
134
+ self.close_button = tk.Button(master=self.master, text="Close", command=self.master.quit)
135
+ self.close_button.pack(side="bottom", pady=10)
136
+
137
+ self.detail_frame = None
138
+
139
+ self.draw_graph()
140
+ print("GraphWorkflowVisualizer initialized with nodes and edges.")
141
+
142
+ def draw_graph(self):
143
+ self.ax.clear()
144
+ node_colors = [GraphWorkflowVisualizer.color_map.get(self.status[n], "gray") for n in self.G.nodes()]
145
+
146
+ nx.draw(
147
+ self.G,
148
+ pos=self.pos,
149
+ with_labels=True,
150
+ node_color=node_colors,
151
+ node_size=2000,
152
+ font_size=9,
153
+ font_weight='bold',
154
+ arrows=True,
155
+ ax=self.ax
156
+ )
157
+ self.draw_legend()
158
+ self.ax.set_title("Project Workflow Execution", fontsize=14)
159
+ self.canvas.draw()
160
+
161
+ def mark_step(self, step_name: str, status: str = DONE):
162
+ if step_name in self.status:
163
+ self.status[step_name] = status
164
+ if self.mode == GraphWorkflowVisualizer.GRAPH:
165
+ self.draw_graph()
166
+
167
+ def mark_substep(self, node: str, substep_name: str, status: str):
168
+ if node not in self.subgraphs:
169
+ self.subgraphs[node] = nx.DiGraph()
170
+ self.substatus[node] = {}
171
+
172
+ G = self.subgraphs[node]
173
+ G.add_node(substep_name)
174
+
175
+ if self.substatus[node] and substep_name not in self.substatus[node]:
176
+ last_substep = list(self.substatus[node].keys())[-1]
177
+ G.add_edge(last_substep, substep_name)
178
+
179
+ self.substatus[node][substep_name] = status
180
+
181
+ if self.mode == GraphWorkflowVisualizer.DETAIL and self.current_node == node:
182
+ self.show_node_detail(node)
183
+
184
+ def mark_node_as_graph(self, parent_node: str, substep_name: str):
185
+ if parent_node not in self.subgraph_nodes:
186
+ self.subgraph_nodes[parent_node] = set()
187
+ self.subgraph_nodes[parent_node].add(substep_name)
188
+
189
+ def on_click(self, event):
190
+ if self.mode == GraphWorkflowVisualizer.GRAPH:
191
+ for node, (x, y) in self.pos.items():
192
+ x_disp, y_disp = self.ax.transData.transform((x, y))
193
+ dist = ((event.x - x_disp) ** 2 + (event.y - y_disp) ** 2) ** 0.5
194
+ if dist < 25:
195
+ self.show_node_detail(node)
196
+ break
197
+ elif self.mode == GraphWorkflowVisualizer.DETAIL:
198
+ subgraph = self.subgraphs.get(self.current_node)
199
+ if not subgraph:
200
+ return
201
+
202
+ pos = nx.spring_layout(subgraph, seed=3)
203
+ for node, (x, y) in pos.items():
204
+ x_disp, y_disp = self.ax.transData.transform((x, y))
205
+ dist = ((event.x - x_disp) ** 2 + (event.y - y_disp) ** 2) ** 0.5
206
+ if dist < 25:
207
+ if node in self.subgraph_nodes.get(self.current_node, set()):
208
+ self.show_node_detail(node, parent_path=self.current_path)
209
+ break
210
+
211
+ def show_node_detail(self, node, parent_path=None):
212
+ self.mode = GraphWorkflowVisualizer.DETAIL
213
+ self.current_node = node
214
+
215
+ if parent_path is None:
216
+ self.current_path = [node]
217
+ else:
218
+ self.current_path = parent_path + [node]
219
+
220
+ self.ax.clear()
221
+
222
+ subgraph = self.subgraphs.get(node)
223
+ substatus = self.substatus.get(node, {})
224
+
225
+ if subgraph:
226
+ pos = nx.spring_layout(subgraph, seed=3)
227
+ node_colors = []
228
+ for n in subgraph.nodes():
229
+ st = substatus.get(n, GraphWorkflowVisualizer.IDLE)
230
+ node_colors.append(GraphWorkflowVisualizer.color_map.get(st, 'gray'))
231
+
232
+ nx.draw(
233
+ subgraph, pos,
234
+ with_labels=True,
235
+ node_color=node_colors,
236
+ node_size=1200,
237
+ font_size=9,
238
+ font_weight='bold',
239
+ arrows=True,
240
+ ax=self.ax
241
+ )
242
+ self.draw_legend()
243
+ self.ax.set_title(f"Subgraph for: {' > '.join(self.current_path)}", fontsize=14)
244
+ else:
245
+ self.ax.set_title(f"No substeps defined for: {node}", fontsize=14)
246
+
247
+ self.canvas.draw()
248
+
249
+ if not self.detail_frame:
250
+ self.detail_frame = tk.Frame(self.master)
251
+ self.detail_frame.pack(pady=10)
252
+ back_btn = tk.Button(self.detail_frame, text="⬅ Back", command=self.back_one_level)
253
+ back_btn.pack()
254
+
255
+ def back_to_graph(self):
256
+ self.mode = GraphWorkflowVisualizer.GRAPH
257
+ self.current_node = None
258
+ if self.detail_frame:
259
+ self.detail_frame.pack_forget()
260
+ self.detail_frame = None
261
+ self.draw_graph()
262
+
263
+ def back_one_level(self):
264
+ if len(self.current_path) <= 1:
265
+ self.current_path = []
266
+ self.back_to_graph()
267
+ else:
268
+ self.current_path.pop() # Remove current
269
+ prev_node = self.current_path[-1]
270
+ self.show_node_detail(prev_node, parent_path=self.current_path[:-1])
271
+
272
+ def draw_legend(self):
273
+ legend_elements = [
274
+ Patch(facecolor='lightgray', label='Idle'),
275
+ Patch(facecolor='#1E90FF', label='Current'),
276
+ Patch(facecolor='limegreen', label='Done'),
277
+ Patch(facecolor='red', label='Fail'),
278
+ Patch(facecolor='gold', label='Skipped'),
279
+ ]
280
+ self.ax.legend(handles=legend_elements, loc='lower right')
281
+
282
+ def on_close(self):
283
+ self.master.quit()
284
+ self.master.destroy()
File without changes
@@ -0,0 +1,4 @@
1
+ from jpipe_runner import runner
2
+
3
+ if __name__ == '__main__':
4
+ runner.main()
@@ -0,0 +1,31 @@
1
+ """
2
+ jpipe_runner.enums
3
+ ~~~~~~~~~~~~~~~~~~
4
+
5
+ This module contains the enums of Justification Diagram.
6
+ """
7
+
8
+ from enum import Enum
9
+
10
+
11
+ class ClassType(Enum):
12
+ """justification / pattern / composition"""
13
+ JUSTIFICATION = "justification"
14
+ PATTERN = "pattern"
15
+ COMPOSITION = "composition"
16
+
17
+
18
+ class VariableType(Enum):
19
+ """evidence / strategy / sub-conclusion / conclusion / @support"""
20
+ EVIDENCE = "evidence"
21
+ STRATEGY = "strategy"
22
+ SUB_CONCLUSION = "sub-conclusion"
23
+ CONCLUSION = "conclusion"
24
+ SUPPORT = "@support"
25
+
26
+
27
+ class StatusType(Enum):
28
+ """PASS / FAIL / SKIP"""
29
+ PASS = "PASS"
30
+ FAIL = "FAIL"
31
+ SKIP = "SKIP"
@@ -0,0 +1,30 @@
1
+ """
2
+ jpipe_runner.exceptions
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ This module contains the set of jPipe Runner's exceptions.
6
+ """
7
+
8
+
9
+ class RunnerException(Exception):
10
+ """There was an ambiguous exception that occurred while running the runner."""
11
+
12
+
13
+ class SyntaxException(SyntaxError, RunnerException):
14
+ """A syntax error occurred."""
15
+
16
+
17
+ class InvalidJustificationException(RunnerException):
18
+ """An invalid justification error occurred."""
19
+
20
+
21
+ class JustificationTraverseException(RunnerException):
22
+ """A justification layered traverse error occurred."""
23
+
24
+
25
+ class RuntimeException(RuntimeError, RunnerException):
26
+ """A runtime error of jpipe runner occurred."""
27
+
28
+
29
+ class FunctionException(RunnerException):
30
+ """A justification function error occurred."""