sysml2py 0.5.2__tar.gz → 1.0.0__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.
- sysml2py-1.0.0/.gitignore +161 -0
- {sysml2py-0.5.2 → sysml2py-1.0.0}/LICENSE +0 -0
- sysml2py-1.0.0/PKG-INFO +106 -0
- sysml2py-1.0.0/README.md +67 -0
- sysml2py-1.0.0/pyproject.toml +57 -0
- sysml2py-1.0.0/src/sysml2py/__init__.py +1470 -0
- sysml2py-1.0.0/src/sysml2py/ast_classes.py +37445 -0
- sysml2py-1.0.0/src/sysml2py/ast_dispatch.py +1542 -0
- sysml2py-1.0.0/src/sysml2py/builders.py +2672 -0
- sysml2py-1.0.0/src/sysml2py/normalize.py +186 -0
- sysml2py-1.0.0/src/sysml2py/printer.py +46 -0
- sysml2py-1.0.0/src/sysml2py/provenance.py +28 -0
- sysml2py-1.0.0/src/sysml2py/traversal.py +115 -0
- sysml2py-0.5.2/PKG-INFO +0 -108
- sysml2py-0.5.2/README.md +0 -91
- sysml2py-0.5.2/pyproject.toml +0 -111
- sysml2py-0.5.2/src/sysml2py/__init__.py +0 -161
- sysml2py-0.5.2/src/sysml2py/definition.py +0 -254
- sysml2py-0.5.2/src/sysml2py/formatting.py +0 -47
- sysml2py-0.5.2/src/sysml2py/grammar/KerML.tx +0 -1116
- sysml2py-0.5.2/src/sysml2py/grammar/KerMLExpressions.tx +0 -578
- sysml2py-0.5.2/src/sysml2py/grammar/SysML.tx +0 -2354
- sysml2py-0.5.2/src/sysml2py/grammar/SysML_compiled.tx +0 -3233
- sysml2py-0.5.2/src/sysml2py/grammar/classes.py +0 -5832
- sysml2py-0.5.2/src/sysml2py/textx/KerML.xtext +0 -1114
- sysml2py-0.5.2/src/sysml2py/textx/KerMLExpressions.xtext +0 -558
- sysml2py-0.5.2/src/sysml2py/textx/SysML.xtext +0 -2380
- sysml2py-0.5.2/src/sysml2py/textx/xtext_to_textx.py +0 -221
- sysml2py-0.5.2/src/sysml2py/usage.py +0 -731
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
#.idea/
|
|
161
|
+
.DS_Store
|
|
File without changes
|
sysml2py-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sysml2py
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Autogenerated SysML v2 builder library (generated by sysml2py-lab).
|
|
5
|
+
Project-URL: Homepage, https://github.com/Westfall-io/sysml2py
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/Westfall-io/sysml2py/issues
|
|
7
|
+
Author: Westfall-io
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2023 Westfall-io
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Classifier: Development Status :: 4 - Beta
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Operating System :: OS Independent
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Requires-Python: >=3.10
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: astropy>=5.3; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest>=7.4; extra == 'dev'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# sysml2py (generated)
|
|
41
|
+
|
|
42
|
+
Version **1.0.0** — generated by **sysml2py-lab** from the SysML v2
|
|
43
|
+
grammar + relationship model + corpus (issues #6/#7/#8/#9/#13).
|
|
44
|
+
|
|
45
|
+
Capabilities:
|
|
46
|
+
- Generated AST node classes per grammar rule
|
|
47
|
+
- Membership-dispatch table from children.json
|
|
48
|
+
- `dump()` / `get_definition()` on every node (loss-minimizing)
|
|
49
|
+
- `Unsupported` nodes carry raw text (zero NotImplementedError)
|
|
50
|
+
- Provenance stamp in `sysml2py.provenance`
|
|
51
|
+
|
|
52
|
+
## Building a model (friendly builder API)
|
|
53
|
+
|
|
54
|
+
Friendly names drop the `Builder`/`Usage`/`Definition` suffixes —
|
|
55
|
+
`Part`, `Attribute`, `Item`, ... are builders; usage vs definition is
|
|
56
|
+
chosen at creation via `kind=`; `add()` appends children so a full
|
|
57
|
+
package dumps from nested composition:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from sysml2py import PackageBuilder, Part, Attribute
|
|
61
|
+
|
|
62
|
+
pkg = PackageBuilder('MyModel')
|
|
63
|
+
stage = Part('Stage_1')
|
|
64
|
+
stage.add(Attribute('mass'))
|
|
65
|
+
stage.add(Attribute('thrust'))
|
|
66
|
+
pkg.add(stage)
|
|
67
|
+
print(pkg.dump())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
package MyModel
|
|
72
|
+
{
|
|
73
|
+
part Stage_1
|
|
74
|
+
{
|
|
75
|
+
attribute mass;
|
|
76
|
+
attribute thrust;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Definitions are the same class with `kind=` at creation:
|
|
82
|
+
`Part('Stage_1', kind='definition')` -> `part def Stage_1;`
|
|
83
|
+
|
|
84
|
+
Kinds without a definition form (`Package`, `Comment`, `Actor`,
|
|
85
|
+
`Reference`, `Transition`, `Import`, `Message`, `Succession`,
|
|
86
|
+
`AliasMember`, `Subject`, `ObjectiveRequirement`) reject
|
|
87
|
+
`kind='definition'` with a `ValueError` — the generator never
|
|
88
|
+
emits a definition it cannot cast back (and a class-name kind
|
|
89
|
+
like `'PartDefinition'` raises
|
|
90
|
+
too, since that would print invalid SysML).
|
|
91
|
+
|
|
92
|
+
`Package`/`Comment`/`Import`/`Message`/`Succession`/`AliasMember`
|
|
93
|
+
keep the `*Builder` suffix
|
|
94
|
+
(their friendly names are the AST node classes). The classic `*Builder`
|
|
95
|
+
names (`PartUsageBuilder`, ...) remain available.
|
|
96
|
+
|
|
97
|
+
Value-bearing attributes are supported: `Attribute('mass', value=1000,
|
|
98
|
+
unit='kg')` renders `attribute mass = 1000[kg];`, with the unit imported
|
|
99
|
+
automatically as `public import SI::kg;` (issue #26, lab repo). You may also
|
|
100
|
+
pass an astropy `Quantity` and the unit is derived from it (`value=1000*u.kg`)
|
|
101
|
+
— add `import astropy.units as u` yourself, since the runtime stays
|
|
102
|
+
pure-stdlib (astropy is not bundled; see the migration note).
|
|
103
|
+
|
|
104
|
+
Compatibility: this is the **1.x** line. Moving from 0.5.x? see
|
|
105
|
+
the migration note:
|
|
106
|
+
https://github.com/Westfall-io/sysml2py-lab/blob/main/docs/migration-0.5-to-1.0.md
|
sysml2py-1.0.0/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# sysml2py (generated)
|
|
2
|
+
|
|
3
|
+
Version **1.0.0** — generated by **sysml2py-lab** from the SysML v2
|
|
4
|
+
grammar + relationship model + corpus (issues #6/#7/#8/#9/#13).
|
|
5
|
+
|
|
6
|
+
Capabilities:
|
|
7
|
+
- Generated AST node classes per grammar rule
|
|
8
|
+
- Membership-dispatch table from children.json
|
|
9
|
+
- `dump()` / `get_definition()` on every node (loss-minimizing)
|
|
10
|
+
- `Unsupported` nodes carry raw text (zero NotImplementedError)
|
|
11
|
+
- Provenance stamp in `sysml2py.provenance`
|
|
12
|
+
|
|
13
|
+
## Building a model (friendly builder API)
|
|
14
|
+
|
|
15
|
+
Friendly names drop the `Builder`/`Usage`/`Definition` suffixes —
|
|
16
|
+
`Part`, `Attribute`, `Item`, ... are builders; usage vs definition is
|
|
17
|
+
chosen at creation via `kind=`; `add()` appends children so a full
|
|
18
|
+
package dumps from nested composition:
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from sysml2py import PackageBuilder, Part, Attribute
|
|
22
|
+
|
|
23
|
+
pkg = PackageBuilder('MyModel')
|
|
24
|
+
stage = Part('Stage_1')
|
|
25
|
+
stage.add(Attribute('mass'))
|
|
26
|
+
stage.add(Attribute('thrust'))
|
|
27
|
+
pkg.add(stage)
|
|
28
|
+
print(pkg.dump())
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
package MyModel
|
|
33
|
+
{
|
|
34
|
+
part Stage_1
|
|
35
|
+
{
|
|
36
|
+
attribute mass;
|
|
37
|
+
attribute thrust;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Definitions are the same class with `kind=` at creation:
|
|
43
|
+
`Part('Stage_1', kind='definition')` -> `part def Stage_1;`
|
|
44
|
+
|
|
45
|
+
Kinds without a definition form (`Package`, `Comment`, `Actor`,
|
|
46
|
+
`Reference`, `Transition`, `Import`, `Message`, `Succession`,
|
|
47
|
+
`AliasMember`, `Subject`, `ObjectiveRequirement`) reject
|
|
48
|
+
`kind='definition'` with a `ValueError` — the generator never
|
|
49
|
+
emits a definition it cannot cast back (and a class-name kind
|
|
50
|
+
like `'PartDefinition'` raises
|
|
51
|
+
too, since that would print invalid SysML).
|
|
52
|
+
|
|
53
|
+
`Package`/`Comment`/`Import`/`Message`/`Succession`/`AliasMember`
|
|
54
|
+
keep the `*Builder` suffix
|
|
55
|
+
(their friendly names are the AST node classes). The classic `*Builder`
|
|
56
|
+
names (`PartUsageBuilder`, ...) remain available.
|
|
57
|
+
|
|
58
|
+
Value-bearing attributes are supported: `Attribute('mass', value=1000,
|
|
59
|
+
unit='kg')` renders `attribute mass = 1000[kg];`, with the unit imported
|
|
60
|
+
automatically as `public import SI::kg;` (issue #26, lab repo). You may also
|
|
61
|
+
pass an astropy `Quantity` and the unit is derived from it (`value=1000*u.kg`)
|
|
62
|
+
— add `import astropy.units as u` yourself, since the runtime stays
|
|
63
|
+
pure-stdlib (astropy is not bundled; see the migration note).
|
|
64
|
+
|
|
65
|
+
Compatibility: this is the **1.x** line. Moving from 0.5.x? see
|
|
66
|
+
the migration note:
|
|
67
|
+
https://github.com/Westfall-io/sysml2py-lab/blob/main/docs/migration-0.5-to-1.0.md
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.24.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sysml2py"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Autogenerated SysML v2 builder library (generated by sysml2py-lab)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [{ name = "Westfall-io" }]
|
|
12
|
+
license = { file = "LICENSE" }
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
dependencies = []
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
dev = [
|
|
24
|
+
"pytest>=7.4",
|
|
25
|
+
"astropy>=5.3",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
"Homepage" = "https://github.com/Westfall-io/sysml2py"
|
|
30
|
+
"Bug Tracker" = "https://github.com/Westfall-io/sysml2py/issues"
|
|
31
|
+
|
|
32
|
+
[tool.hatch.build.targets.sdist]
|
|
33
|
+
# src-layout MUST be preserved in the sdist or `python -m build` (wheel from
|
|
34
|
+
# sdist) produces an EMPTY wheel: hatchling flattens `src/sysml2py` to
|
|
35
|
+
# `sysml2py/` at the sdist root unless the sdist target is given an explicit
|
|
36
|
+
# include. Keep the src/ prefix (verified against hatchling 1.32.4, issue
|
|
37
|
+
# #13 review W2-3).
|
|
38
|
+
include = ["src/sysml2py/**", "README.md", "pyproject.toml", "LICENSE"]
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/sysml2py"]
|
|
42
|
+
# NOTE: do NOT add an `include` filter here. `packages = ["src/sysml2py"]`
|
|
43
|
+
# selects EVERYTHING under that dir. An `include` list on the wheel target
|
|
44
|
+
# is RESTRICTIVE and silently empties the wheel; keep package-data selection
|
|
45
|
+
# implicit.
|
|
46
|
+
|
|
47
|
+
# Formatting config is pinned here (NOT discovered by walking up), so ruff /
|
|
48
|
+
# black agree with `_ruff_format` regardless of where the tree is generated.
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
line-length = 100
|
|
51
|
+
target-version = "py310"
|
|
52
|
+
|
|
53
|
+
[tool.black]
|
|
54
|
+
line-length = 100
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
pythonpath = ["src"]
|