ymmsl2svg 0.1__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.
Files changed (50) hide show
  1. ymmsl2svg-0.1/.github/workflows/publish-to-pypi.yml +76 -0
  2. ymmsl2svg-0.1/.github/workflows/test.yml +35 -0
  3. ymmsl2svg-0.1/.gitignore +5 -0
  4. ymmsl2svg-0.1/LICENSE.txt +202 -0
  5. ymmsl2svg-0.1/MANIFEST.in +1 -0
  6. ymmsl2svg-0.1/PKG-INFO +124 -0
  7. ymmsl2svg-0.1/README.md +103 -0
  8. ymmsl2svg-0.1/examples/macro-micro-dispatched.svg +1 -0
  9. ymmsl2svg-0.1/examples/simple-dispatch.svg +1 -0
  10. ymmsl2svg-0.1/pyproject.toml +77 -0
  11. ymmsl2svg-0.1/scripts/textsize.py +25 -0
  12. ymmsl2svg-0.1/setup.cfg +4 -0
  13. ymmsl2svg-0.1/src/ymmsl2svg/__init__.py +6 -0
  14. ymmsl2svg-0.1/src/ymmsl2svg/__main__.py +10 -0
  15. ymmsl2svg-0.1/src/ymmsl2svg/base.py +36 -0
  16. ymmsl2svg-0.1/src/ymmsl2svg/cli.py +42 -0
  17. ymmsl2svg-0.1/src/ymmsl2svg/component_block.py +260 -0
  18. ymmsl2svg-0.1/src/ymmsl2svg/conduit_ducts.py +498 -0
  19. ymmsl2svg-0.1/src/ymmsl2svg/live/__init__.py +0 -0
  20. ymmsl2svg-0.1/src/ymmsl2svg/live/cli.py +43 -0
  21. ymmsl2svg-0.1/src/ymmsl2svg/live/server.py +203 -0
  22. ymmsl2svg-0.1/src/ymmsl2svg/live/viewer.html +249 -0
  23. ymmsl2svg-0.1/src/ymmsl2svg/main.py +40 -0
  24. ymmsl2svg-0.1/src/ymmsl2svg/model_block.py +205 -0
  25. ymmsl2svg-0.1/src/ymmsl2svg/settings.py +36 -0
  26. ymmsl2svg-0.1/src/ymmsl2svg/style.template.css +64 -0
  27. ymmsl2svg-0.1/src/ymmsl2svg/svg_builder.py +59 -0
  28. ymmsl2svg-0.1/src/ymmsl2svg/timeline_block.py +135 -0
  29. ymmsl2svg-0.1/src/ymmsl2svg/timeline_node.py +226 -0
  30. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/PKG-INFO +124 -0
  31. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/SOURCES.txt +48 -0
  32. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/dependency_links.txt +1 -0
  33. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/entry_points.txt +3 -0
  34. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/requires.txt +10 -0
  35. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/scm_file_list.json +44 -0
  36. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/scm_version.json +8 -0
  37. ymmsl2svg-0.1/src/ymmsl2svg.egg-info/top_level.txt +1 -0
  38. ymmsl2svg-0.1/test_output/.gitignore +3 -0
  39. ymmsl2svg-0.1/tests/configurations/dispatch-with-filters.ymmsl +43 -0
  40. ymmsl2svg-0.1/tests/configurations/dispatch3.ymmsl +31 -0
  41. ymmsl2svg-0.1/tests/configurations/macro-micro-dispatched.ymmsl +27 -0
  42. ymmsl2svg-0.1/tests/configurations/more-filters.ymmsl +40 -0
  43. ymmsl2svg-0.1/tests/configurations/node-ordering.ymmsl +29 -0
  44. ymmsl2svg-0.1/tests/configurations/simple-dispatch.ymmsl +25 -0
  45. ymmsl2svg-0.1/tests/configurations/simple-macro-micro.ymmsl +18 -0
  46. ymmsl2svg-0.1/tests/configurations/timescale-bridge.ymmsl +32 -0
  47. ymmsl2svg-0.1/tests/test_component_order.py +39 -0
  48. ymmsl2svg-0.1/tests/test_configurations.py +72 -0
  49. ymmsl2svg-0.1/tests/test_live_viewer.py +149 -0
  50. ymmsl2svg-0.1/tests/test_version.py +7 -0
@@ -0,0 +1,76 @@
1
+ name: Publish Python distribution to PyPI and TestPyPI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build distribution
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v6
12
+ with:
13
+ persist-credentials: false
14
+ fetch-depth: 0
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v6
17
+ with:
18
+ python-version: "3.x"
19
+ - name: Install pypa/build
20
+ run: >-
21
+ python3 -m
22
+ pip install
23
+ build
24
+ --user
25
+ - name: Build a binary wheel and a source tarball
26
+ run: python3 -m build
27
+ - name: Store the distribution packages
28
+ uses: actions/upload-artifact@v7
29
+ with:
30
+ name: python-package-distributions
31
+ path: dist/
32
+
33
+ publish-to-pypi:
34
+ name: >-
35
+ Publish Python distribution to PyPI
36
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
37
+ needs:
38
+ - build
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/ymmsl2svg
43
+ permissions:
44
+ id-token: write # IMPORTANT: mandatory for trusted publishing
45
+
46
+ steps:
47
+ - name: Download all the dists
48
+ uses: actions/download-artifact@v8
49
+ with:
50
+ name: python-package-distributions
51
+ path: dist/
52
+ - name: Publish distribution to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
54
+
55
+ publish-to-testpypi:
56
+ name: Publish Python distribution to TestPyPI
57
+ if: github.ref == 'refs/heads/main'
58
+ needs:
59
+ - build
60
+ runs-on: ubuntu-latest
61
+ environment:
62
+ name: testpypi
63
+ url: https://test.pypi.org/p/ymmsl2svg
64
+ permissions:
65
+ id-token: write # IMPORTANT: mandatory for trusted publishing
66
+
67
+ steps:
68
+ - name: Download all the dists
69
+ uses: actions/download-artifact@v8
70
+ with:
71
+ name: python-package-distributions
72
+ path: dist/
73
+ - name: Publish distribution to TestPyPI
74
+ uses: pypa/gh-action-pypi-publish@release/v1
75
+ with:
76
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,35 @@
1
+ name: Test using pytest
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ types: [opened, synchronize, reopened]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
15
+
16
+ steps:
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v6
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v6
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: pip install .[dev]
27
+
28
+ - name: Run Ruff linter
29
+ run: ruff check --output-format=github
30
+
31
+ - name: Run Ruff formatter
32
+ run: ruff format --diff
33
+
34
+ - name: Run tests
35
+ run: pytest --cov=ymmsl2svg --cov-report=term-missing
@@ -0,0 +1,5 @@
1
+ *.egg-info
2
+ __pycache__
3
+ .coverage
4
+
5
+ docs/_build
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "{}"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1 @@
1
+ include ymmsl2svg/style.template.CSS
ymmsl2svg-0.1/PKG-INFO ADDED
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: ymmsl2svg
3
+ Version: 0.1
4
+ Summary: Visualize yMMSL workflow as Scalable Vector Graphics (SVG)
5
+ Author-email: Maarten Sebregts <msebregts@ignitioncomputing.com>, Iris van der Werf <ivanderwerf@ignitioncomputing.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: homepage, https://github.com/multiscale/ymmsl2svg
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE.txt
11
+ Requires-Dist: click
12
+ Requires-Dist: svg.py
13
+ Requires-Dist: watchfiles>=1.0
14
+ Requires-Dist: ymmsl>=0.18
15
+ Provides-Extra: dev
16
+ Requires-Dist: ruff; extra == "dev"
17
+ Requires-Dist: ty; extra == "dev"
18
+ Requires-Dist: pytest; extra == "dev"
19
+ Requires-Dist: pytest-cov; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # ymmsl2svg: Visualize yMMSL workflows
23
+
24
+ Visualize yMMSL workflow as Scalable Vector Graphics (SVG).
25
+
26
+ This tool takes a yMMSL model (from a v0.2 yMMSL file) and generates an SVG image to
27
+ represent it.
28
+
29
+ ## Features
30
+
31
+ - Visualize the coupling diagram for yMMSL (sub)models
32
+ - Call/release (a.k.a. macro-micro) coupling
33
+ - Dispatch coupling
34
+ - Visualize component ports: F_INIT ports are drawn on the left side of a component as
35
+ an open diamond, O_F ports on the right side as a closed diamond, and O_I and S ports
36
+ on the bottom as respectively a closed and an open circle.
37
+ - Visualize model ports: F_INIT ports on the left side of the model, O_F ports on the
38
+ right side. Model O_I and S ports are not (yet) supported.
39
+ - Visualize "multi-cast" conduits, where one output port sends to multiple input ports.
40
+ - Draw conduits with filters.
41
+
42
+ Note that not `ymmsl2svg` cannot visualize all valid yMMSL configurations, see
43
+ [Roadmap](#roadmap) for a brief overview of missing functionality.
44
+
45
+ ## Examples
46
+
47
+ Click to open the image in a new tab and enable interactive features, such as tooltips
48
+ with the port name when hovering over a port.
49
+
50
+ [![Dispatch submodel with model ports](examples/simple-dispatch.svg)](https://raw.githubusercontent.com/multiscale/ymmsl2svg/refs/heads/main/examples/simple-dispatch.svg)
51
+
52
+ [![Complex call/release coupling](examples/macro-micro-dispatched.svg)](https://raw.githubusercontent.com/multiscale/ymmsl2svg/refs/heads/main/examples/macro-micro-dispatched.svg)
53
+
54
+ ## Installation
55
+
56
+ `ymmsl2svg` is [available on PyPI](https://pypi.org/project/ymmsl2svg/) and can be
57
+ installed with pip:
58
+
59
+ ```bash
60
+ pip install ymmsl2svg
61
+ ```
62
+
63
+ ## Usage
64
+
65
+ ```bash
66
+ # Create 'workflow.svg' image from the root model in 'workflow.ymmsl'
67
+ ymmsl2svg workflow.ymmsl -o workflow.svg
68
+
69
+ # Show supported options and settings
70
+ ymmsl2svg --help
71
+ ```
72
+
73
+ ### Live viewer
74
+
75
+ `ymmsl2svg-live` shows the diagram of a yMMSL file in your browser and re-renders it
76
+ every time you save the file, so you can edit yMMSL in your favourite text editor with
77
+ a live preview next to it. If you save a file with errors, the error message appears
78
+ above the last working diagram. If there is no working diagram yet, you see just the
79
+ error until you fix it. It works on Linux, macOS and Windows (including WSL).
80
+
81
+ To use it on your own computer, run:
82
+
83
+ ```bash
84
+ ymmsl2svg-live workflow.ymmsl
85
+ ```
86
+
87
+ This opens the viewer in your browser. If no browser opens (for example on WSL), copy
88
+ the address printed in the terminal, `http://127.0.0.1:8765`, into your browser. Use
89
+ `--no-open-browser` if you don't want a browser to open automatically. If that address
90
+ is already in use, choose another number with `--port`, for example `--port 12345`.
91
+
92
+ Use `--debug` to enable debug visualizations. Run `ymmsl2svg-live --help` for all
93
+ options.
94
+
95
+ ## Roadmap
96
+
97
+ `ymmsl2svg` currently cannot visualize any valid yMMSL model yet, this section
98
+ provides a brief overview of missing features that we would like to implement in the
99
+ future:
100
+
101
+ - **Missing yMMSL features**
102
+ - Visualize interact coupling diagrams and time-scale bridges.
103
+ <sup>[1](#footnote1)</sup>
104
+ - Visualize components with multiple sub-timelines. <sup>[1](#footnote1)</sup>
105
+ - Visualize O_I and S ports of models. <sup>[2](#footnote2)</sup>
106
+ - **Command Line Interface**
107
+ - Allow selecting a specific model in the yMMSL configuration (currently only the
108
+ [_root_ model](https://ymmsl-python.readthedocs.io/en/stable/api.html#ymmsl.v0_2.Configuration.root_model)
109
+ is visualized).
110
+ - Allow changing settings / parameters from the Command Line interface.
111
+ - **Additional features**
112
+ - Interactive highlight of connected conduits when hovering over components or ports.
113
+ - Add an option to draw parallel components under eachother.
114
+
115
+ <a name="footnote1">1</a>: The SVG generation currently fails for models containing
116
+ this.<br/>
117
+ <a name="footnote1">2</a>: An SVG is generated for models containing this, but a warning
118
+ is logged and the visualization is not complete.<br/>
119
+
120
+
121
+ ## Legal
122
+
123
+ Copyright 2026 ITER Organization. The code in this repository is licensed under the
124
+ [Apache-2.0 license](LICENSE.txt)
@@ -0,0 +1,103 @@
1
+ # ymmsl2svg: Visualize yMMSL workflows
2
+
3
+ Visualize yMMSL workflow as Scalable Vector Graphics (SVG).
4
+
5
+ This tool takes a yMMSL model (from a v0.2 yMMSL file) and generates an SVG image to
6
+ represent it.
7
+
8
+ ## Features
9
+
10
+ - Visualize the coupling diagram for yMMSL (sub)models
11
+ - Call/release (a.k.a. macro-micro) coupling
12
+ - Dispatch coupling
13
+ - Visualize component ports: F_INIT ports are drawn on the left side of a component as
14
+ an open diamond, O_F ports on the right side as a closed diamond, and O_I and S ports
15
+ on the bottom as respectively a closed and an open circle.
16
+ - Visualize model ports: F_INIT ports on the left side of the model, O_F ports on the
17
+ right side. Model O_I and S ports are not (yet) supported.
18
+ - Visualize "multi-cast" conduits, where one output port sends to multiple input ports.
19
+ - Draw conduits with filters.
20
+
21
+ Note that not `ymmsl2svg` cannot visualize all valid yMMSL configurations, see
22
+ [Roadmap](#roadmap) for a brief overview of missing functionality.
23
+
24
+ ## Examples
25
+
26
+ Click to open the image in a new tab and enable interactive features, such as tooltips
27
+ with the port name when hovering over a port.
28
+
29
+ [![Dispatch submodel with model ports](examples/simple-dispatch.svg)](https://raw.githubusercontent.com/multiscale/ymmsl2svg/refs/heads/main/examples/simple-dispatch.svg)
30
+
31
+ [![Complex call/release coupling](examples/macro-micro-dispatched.svg)](https://raw.githubusercontent.com/multiscale/ymmsl2svg/refs/heads/main/examples/macro-micro-dispatched.svg)
32
+
33
+ ## Installation
34
+
35
+ `ymmsl2svg` is [available on PyPI](https://pypi.org/project/ymmsl2svg/) and can be
36
+ installed with pip:
37
+
38
+ ```bash
39
+ pip install ymmsl2svg
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ ```bash
45
+ # Create 'workflow.svg' image from the root model in 'workflow.ymmsl'
46
+ ymmsl2svg workflow.ymmsl -o workflow.svg
47
+
48
+ # Show supported options and settings
49
+ ymmsl2svg --help
50
+ ```
51
+
52
+ ### Live viewer
53
+
54
+ `ymmsl2svg-live` shows the diagram of a yMMSL file in your browser and re-renders it
55
+ every time you save the file, so you can edit yMMSL in your favourite text editor with
56
+ a live preview next to it. If you save a file with errors, the error message appears
57
+ above the last working diagram. If there is no working diagram yet, you see just the
58
+ error until you fix it. It works on Linux, macOS and Windows (including WSL).
59
+
60
+ To use it on your own computer, run:
61
+
62
+ ```bash
63
+ ymmsl2svg-live workflow.ymmsl
64
+ ```
65
+
66
+ This opens the viewer in your browser. If no browser opens (for example on WSL), copy
67
+ the address printed in the terminal, `http://127.0.0.1:8765`, into your browser. Use
68
+ `--no-open-browser` if you don't want a browser to open automatically. If that address
69
+ is already in use, choose another number with `--port`, for example `--port 12345`.
70
+
71
+ Use `--debug` to enable debug visualizations. Run `ymmsl2svg-live --help` for all
72
+ options.
73
+
74
+ ## Roadmap
75
+
76
+ `ymmsl2svg` currently cannot visualize any valid yMMSL model yet, this section
77
+ provides a brief overview of missing features that we would like to implement in the
78
+ future:
79
+
80
+ - **Missing yMMSL features**
81
+ - Visualize interact coupling diagrams and time-scale bridges.
82
+ <sup>[1](#footnote1)</sup>
83
+ - Visualize components with multiple sub-timelines. <sup>[1](#footnote1)</sup>
84
+ - Visualize O_I and S ports of models. <sup>[2](#footnote2)</sup>
85
+ - **Command Line Interface**
86
+ - Allow selecting a specific model in the yMMSL configuration (currently only the
87
+ [_root_ model](https://ymmsl-python.readthedocs.io/en/stable/api.html#ymmsl.v0_2.Configuration.root_model)
88
+ is visualized).
89
+ - Allow changing settings / parameters from the Command Line interface.
90
+ - **Additional features**
91
+ - Interactive highlight of connected conduits when hovering over components or ports.
92
+ - Add an option to draw parallel components under eachother.
93
+
94
+ <a name="footnote1">1</a>: The SVG generation currently fails for models containing
95
+ this.<br/>
96
+ <a name="footnote1">2</a>: An SVG is generated for models containing this, but a warning
97
+ is logged and the visualization is not complete.<br/>
98
+
99
+
100
+ ## Legal
101
+
102
+ Copyright 2026 ITER Organization. The code in this repository is licensed under the
103
+ [Apache-2.0 license](LICENSE.txt)
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="348" height="163"><style> .TimelineBlock{fill:rgb(195,130,255);}.TopConduitDuct{fill:#ccc;}.ConduitDuct{fill:#aaa;}.ComponentBlock{fill:rgb(134,146,255);}.ModelBlock{fill:#baffbd;}text{font-family:sans-serif;font-size:16px;}.model{rx:1;fill:#eee;stroke:#000;stroke-width:2;}.component{rx:5;fill:#fff;stroke:#000;stroke-width:2;}.ComponentBlock_group text{text-anchor:middle;dominant-baseline:middle;}#port-f_init,#port-o_f,#port-o_i,#port-s{stroke:black;stroke-width:2;}#port-f_init,#port-s{fill:white;}#port-o_f,#port-o_i{fill:black;}.conduit{fill:none;stroke:#000;stroke-linecap:square;stroke-width:2;}</style><defs><path id="port-f_init" d="M 1 0 L 4 -3 L 7 0 L 4 3 Z "/><path id="port-o_f" d="M -1 0 L -4 -3 L -7 0 L -4 3 Z "/><circle id="port-o_i" cy="-3.5" r="2.5"/><circle id="port-s" cy="-3.5" r="2.5"/></defs><g class="ModelBlock_group"><rect class="model" id="model-macro_micro" x="11.0" y="11.0" width="326" height="141"><title>Model: macro_micro</title></rect><g transform="translate(20 20)" class="TimelineBlock_group"><g class="ConduitDuct_group"/><g class="ComponentBlock_group"><rect class="component" id="component-macro" x="8.0" y="1.0" width="292" height="48"/><text x="154.0" y="25.0">macro</text><use href="#port-o_i" x="12.0" y="57"><title>output3</title></use><use href="#port-o_i" x="22.0" y="57"><title>output</title></use><use href="#port-o_i" x="32.0" y="57"><title>output2</title></use><use href="#port-s" x="286.0" y="57"><title>input1</title></use><use href="#port-s" x="296.0" y="57"><title>input2</title></use></g><g class="ConduitDuct_group"/><g transform="translate(7 57)" class="TimelineBlock_group"><g class="ConduitDuct_group"/><g class="ComponentBlock_group"><rect class="component" id="component-micro1" x="38.0" y="17.0" width="98" height="48"/><text x="87.0" y="41.0">micro1</text><use href="#port-f_init" x="30" y="36.0"><title>input</title></use><use href="#port-f_init" x="30" y="46.0"><title>input2</title></use><use href="#port-o_f" x="144" y="41.0"><title>output</title></use></g><g class="ConduitDuct_group"/><g class="ComponentBlock_group"><rect class="component" id="component-micro2" x="168.0" y="17.0" width="98" height="48"/><text x="217.0" y="41.0">micro2</text><use href="#port-f_init" x="160" y="31.0"><title>input3</title></use><use href="#port-f_init" x="160" y="41.0"><title>input2</title></use><use href="#port-f_init" x="160" y="51.0"><title>input1</title></use><use href="#port-o_f" x="274" y="41.0"><title>output</title></use></g><g class="ConduitDuct_group"/><g class="TopConduitDuct_group"><path class="conduit" d="M 25.0 0 H 25.0 V 2.0 H 158.0 V 31.0 H 160"/><path class="conduit" d="M 15.0 0 H 15.0 V 36.0 H 30"/><path class="conduit" d="M 15.0 0 H 15.0 V 6.0 H 154.0 V 41.0 H 160"/><path class="conduit" d="M 5.0 0 H 5.0 V 46.0 H 30"/><path class="conduit" d="M 144 41.0 H 150.0 V 51.0 H 160"/><path class="conduit" d="M 144 41.0 H 146.0 V 10.0 H 279.0 V 0 H 279.0"/><path class="conduit" d="M 274 41.0 H 289.0 V 0 H 289.0"/></g></g><g class="TopConduitDuct_group"/></g></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="322" height="90"><style> .TimelineBlock{fill:rgb(195,130,255);}.TopConduitDuct{fill:#ccc;}.ConduitDuct{fill:#aaa;}.ComponentBlock{fill:rgb(134,146,255);}.ModelBlock{fill:#baffbd;}text{font-family:sans-serif;font-size:16px;}.model{rx:1;fill:#eee;stroke:#000;stroke-width:2;}.component{rx:5;fill:#fff;stroke:#000;stroke-width:2;}.ComponentBlock_group text{text-anchor:middle;dominant-baseline:middle;}#port-f_init,#port-o_f,#port-o_i,#port-s{stroke:black;stroke-width:2;}#port-f_init,#port-s{fill:white;}#port-o_f,#port-o_i{fill:black;}.conduit{fill:none;stroke:#000;stroke-linecap:square;stroke-width:2;}</style><defs><path id="port-f_init" d="M 1 0 L 4 -3 L 7 0 L 4 3 Z "/><path id="port-o_f" d="M -1 0 L -4 -3 L -7 0 L -4 3 Z "/><circle id="port-o_i" cy="-3.5" r="2.5"/><circle id="port-s" cy="-3.5" r="2.5"/></defs><g class="ModelBlock_group"><rect class="model" id="model-dispatch" x="11.0" y="11.0" width="300" height="68"><title>Model: dispatch</title></rect><use href="#port-f_init" x="3" y="25.0"><title>input1</title></use><path class="conduit" d="M 10 25.0 h 10"/><use href="#port-f_init" x="3" y="35.0"><title>input2</title></use><path class="conduit" d="M 10 35.0 h 10"/><use href="#port-f_init" x="3" y="45.0"><title>input3</title></use><path class="conduit" d="M 10 45.0 h 10"/><use href="#port-f_init" x="3" y="55.0"><title>input4</title></use><path class="conduit" d="M 10 55.0 h 10"/><use href="#port-o_f" x="319" y="25.0"><title>output</title></use><path class="conduit" d="M 312 25.0 h -10"/><g transform="translate(20 20)" class="TimelineBlock_group"><g class="ConduitDuct_group"/><g class="ComponentBlock_group"><rect class="component" id="component-first" x="48.0" y="1.0" width="98" height="48"/><text x="97.0" y="25.0">first</text><use href="#port-f_init" x="40" y="10.0"><title>input1</title></use><use href="#port-f_init" x="40" y="20.0"><title>input2</title></use><use href="#port-f_init" x="40" y="30.0"><title>input3</title></use><use href="#port-f_init" x="40" y="40.0"><title>input4</title></use><use href="#port-o_f" x="154" y="25.0"><title>output</title></use></g><g class="ConduitDuct_group"/><g class="ComponentBlock_group"><rect class="component" id="component-second" x="166.0" y="1.0" width="98" height="48"/><text x="215.0" y="25.0">second</text><use href="#port-f_init" x="158" y="25.0"><title>input</title></use><use href="#port-o_f" x="272" y="25.0"><title>output</title></use></g><g class="ConduitDuct_group"/><g class="TopConduitDuct_group"><path class="conduit" d="M 0 5.0 H 5.0 V 10.0 H 40"/><path class="conduit" d="M 0 15.0 H 15.0 V 20.0 H 40"/><path class="conduit" d="M 0 25.0 H 25.0 V 30.0 H 40"/><path class="conduit" d="M 0 35.0 H 35.0 V 40.0 H 40"/><path class="conduit" d="M 154 25.0 H 156.0 V 25.0 H 158"/><path class="conduit" d="M 272 25.0 H 277.0 V 5.0 H 282"/></g></g></g></svg>
@@ -0,0 +1,77 @@
1
+ [build-system]
2
+ requires = ["setuptools>=80", "setuptools-scm>=8"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ymmsl2svg"
7
+ description = "Visualize yMMSL workflow as Scalable Vector Graphics (SVG)"
8
+ readme = {file = "README.md", content-type = "text/markdown" }
9
+ authors = [
10
+ {name = "Maarten Sebregts", email = "msebregts@ignitioncomputing.com"},
11
+ {name = "Iris van der Werf", email = "ivanderwerf@ignitioncomputing.com"},
12
+ ]
13
+ classifiers = [
14
+ ]
15
+ license = "Apache-2.0"
16
+ dependencies = [
17
+ "click",
18
+ "svg.py",
19
+ "watchfiles >= 1.0",
20
+ "ymmsl >= 0.18",
21
+ ]
22
+ dynamic = ["version"]
23
+ requires-python = ">= 3.10"
24
+
25
+ [project.optional-dependencies]
26
+ dev = [
27
+ "ruff",
28
+ "ty",
29
+ "pytest",
30
+ "pytest-cov",
31
+ ]
32
+
33
+ [project.urls]
34
+ homepage = "https://github.com/multiscale/ymmsl2svg"
35
+
36
+ [project.scripts]
37
+ ymmsl2svg = "ymmsl2svg.cli:main"
38
+ ymmsl2svg-live = "ymmsl2svg.live.cli:main"
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["src"]
42
+ include = ["ymmsl2svg*"]
43
+
44
+ [tool.setuptools_scm]
45
+ local_scheme = "no-local-version"
46
+
47
+ [tool.pytest.ini_options]
48
+ testpaths = [
49
+ "tests",
50
+ ]
51
+
52
+
53
+ [tool.ruff]
54
+ include = ["pyproject.toml", "sphinx_ymmsl/**/*.py", "tests/**/*.py"]
55
+ exclude = [
56
+ "docs",
57
+ ".git",
58
+ ]
59
+ # Same as Black
60
+ line-length = 88
61
+ indent-width = 4
62
+
63
+ [tool.ruff.lint]
64
+ select = [
65
+ # pycodestyle
66
+ "E",
67
+ # Pyflakes
68
+ "F",
69
+ # pyupgrade
70
+ "UP",
71
+ # flake8-bugbear
72
+ "B",
73
+ # flake8-simplify
74
+ "SIM",
75
+ # isort
76
+ "I",
77
+ ]