sysmlpy 0.1.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.
- sysmlpy-0.1.0/LICENSE +21 -0
- sysmlpy-0.1.0/PKG-INFO +230 -0
- sysmlpy-0.1.0/README.md +187 -0
- sysmlpy-0.1.0/pyproject.toml +136 -0
- sysmlpy-0.1.0/src/sysmlpy/__init__.py +226 -0
- sysmlpy-0.1.0/src/sysmlpy/__main__.py +75 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/README.md +146 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2Lexer.interp +695 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2Lexer.py +1123 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2Lexer.tokens +444 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2Parser.interp +960 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2Parser.py +40750 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2Parser.tokens +444 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2ParserListener.py +4485 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/SysMLv2ParserVisitor.py +2498 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +695 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +1123 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +444 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr_parser.py +185 -0
- sysmlpy-0.1.0/src/sysmlpy/antlr_visitor.py +10864 -0
- sysmlpy-0.1.0/src/sysmlpy/definition.py +1115 -0
- sysmlpy-0.1.0/src/sysmlpy/examples/attribute_values.py +161 -0
- sysmlpy-0.1.0/src/sysmlpy/examples/part_attributes.py +139 -0
- sysmlpy-0.1.0/src/sysmlpy/examples/tuples_sequences.py +231 -0
- sysmlpy-0.1.0/src/sysmlpy/formatting.py +47 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/README.md +30 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.g4 +931 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +695 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +1123 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +444 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Parser.g4 +2432 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Parser.interp +960 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Parser.py +40750 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2Parser.tokens +444 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2ParserListener.py +4485 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/SysMLv2ParserVisitor.py +2498 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/desc.xml +7 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/examples/camera.sysml +14 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/examples/toaster-system.sysml +193 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/examples/vehicle-model.sysml +118 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/antlr4/pom.xml +59 -0
- sysmlpy-0.1.0/src/sysmlpy/grammar/classes.py +8610 -0
- sysmlpy-0.1.0/src/sysmlpy/library/LICENSE +165 -0
- sysmlpy-0.1.0/src/sysmlpy/library/README.md +52 -0
- sysmlpy-0.1.0/src/sysmlpy/library/__init__.py +0 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Analysis/AnalysisTooling.sysml +34 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Analysis/SampledFunctions.sysml +119 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Analysis/StateSpaceRepresentation.sysml +143 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Analysis/TradeStudies.sysml +171 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Cause and Effect/CausationConnections.sysml +83 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Cause and Effect/CauseAndEffect.sysml +81 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Geometry/ShapeItems.sysml +899 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Geometry/SpatialItems.sysml +168 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Metadata/ImageMetadata.sysml +78 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Metadata/ModelingMetadata.sysml +143 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Metadata/ParametersOfInterestMetadata.sysml +39 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Metadata/RiskMetadata.sysml +100 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQ.sysml +42 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQAcoustics.sysml +439 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQAtomicNuclear.sysml +2726 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQBase.sysml +206 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQCharacteristicNumbers.sysml +1991 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQChemistryMolecular.sysml +1353 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQCondensedMatter.sysml +1223 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQElectromagnetism.sysml +2333 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQInformation.sysml +958 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQLight.sysml +1537 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQMechanics.sysml +1564 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQSpaceTime.sysml +1169 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/ISQThermodynamics.sysml +1256 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/MeasurementRefCalculations.sysml +30 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/MeasurementReferences.sysml +526 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/Quantities.sysml +107 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/QuantityCalculations.sysml +70 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/SI.sysml +378 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/SIPrefixes.sysml +48 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/TensorCalculations.sysml +50 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/Time.sysml +274 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/USCustomaryUnits.sysml +260 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Quantities and Units/VectorCalculations.sysml +62 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Requirement Derivation/DerivationConnections.sysml +63 -0
- sysmlpy-0.1.0/src/sysmlpy/library/domain/Requirement Derivation/RequirementDerivation.sysml +39 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Base.kerml +95 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/BaseFunctions.kerml +80 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/BooleanFunctions.kerml +22 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Clocks.kerml +156 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/CollectionFunctions.kerml +68 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Collections.kerml +147 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/ComplexFunctions.kerml +47 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/ControlFunctions.kerml +117 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/ControlPerformances.kerml +135 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/DataFunctions.kerml +43 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/FeatureReferencingPerformances.kerml +190 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/IntegerFunctions.kerml +43 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/KerML.kerml +483 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Links.kerml +67 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Metaobjects.kerml +58 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/NaturalFunctions.kerml +27 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/NumericalFunctions.kerml +43 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Objects.kerml +212 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Observation.kerml +161 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/OccurrenceFunctions.kerml +154 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Occurrences.kerml +992 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Performances.kerml +293 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/RationalFunctions.kerml +49 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/RealFunctions.kerml +56 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/ScalarFunctions.kerml +33 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/ScalarValues.kerml +23 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/SequenceFunctions.kerml +111 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/SpatialFrames.kerml +197 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/StatePerformances.kerml +145 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/StringFunctions.kerml +25 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Transfers.kerml +281 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/TransitionPerformances.kerml +66 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/TrigFunctions.kerml +35 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/Triggers.kerml +188 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/VectorFunctions.kerml +273 -0
- sysmlpy-0.1.0/src/sysmlpy/library/kernel/VectorValues.kerml +64 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Actions.sysml +552 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Allocations.sysml +29 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/AnalysisCases.sysml +38 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Attributes.sysml +25 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Calculations.sysml +37 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Cases.sysml +71 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Connections.sysml +60 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Constraints.sysml +44 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Flows.sysml +126 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Interfaces.sysml +89 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Items.sysml +153 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Metadata.sysml +32 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Parts.sysml +81 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Ports.sysml +54 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Requirements.sysml +194 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/StandardViewDefinitions.sysml +123 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/States.sysml +103 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/SysML.sysml +539 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/UseCases.sysml +57 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/VerificationCases.sysml +103 -0
- sysmlpy-0.1.0/src/sysmlpy/library/systems/Views.sysml +164 -0
- sysmlpy-0.1.0/src/sysmlpy/navigate.py +272 -0
- sysmlpy-0.1.0/src/sysmlpy/store.py +547 -0
- sysmlpy-0.1.0/src/sysmlpy/usage.py +2978 -0
sysmlpy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Westfall-io
|
|
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.
|
sysmlpy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sysmlpy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: SysML v2.0 Parser
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023 Westfall-io
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Author: Jon R. Fox (mycr0ft)
|
|
28
|
+
Author-email: jon.fox@drfox.com
|
|
29
|
+
Requires-Python: >=3.7
|
|
30
|
+
Classifier: Development Status :: 3 - Alpha
|
|
31
|
+
Classifier: Programming Language :: Python :: 3
|
|
32
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
33
|
+
Classifier: Operating System :: OS Independent
|
|
34
|
+
Provides-Extra: graph
|
|
35
|
+
Requires-Dist: antlr4-python3-runtime (>=4.13)
|
|
36
|
+
Requires-Dist: networkx (>=3.0) ; extra == "graph"
|
|
37
|
+
Requires-Dist: pint (>=0.24)
|
|
38
|
+
Requires-Dist: pyyaml (>=6.0)
|
|
39
|
+
Project-URL: Bug Tracker, https://github.com/Westfall-io/sysmlpy/issues
|
|
40
|
+
Project-URL: Homepage, https://github.com/Westfall-io/sysmlpy
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# sysmlpy
|
|
44
|
+
[](https://badge.fury.io/py/sysmlpy)[](https://pypi.python.org/pypi/sysmlpy/)[](https://lbesson.mit-license.org/)
|
|
45
|
+
|
|
46
|
+
## Description
|
|
47
|
+
sysmlpy is an open source pure Python library for constructing python-based
|
|
48
|
+
classes consistent with the [SysML v2.0 standard](https://github.com/Systems-Modeling/SysML-v2-Release).
|
|
49
|
+
|
|
50
|
+
This project began as a fork of the sysml2py project by [Christopher
|
|
51
|
+
Cox](https://github.com/chriscox-westfall). Since April 2026 [Jon Fox](mailto:jon.fox@drfox.com)
|
|
52
|
+
decided to complete coverage of all SysMLv2 features over two months of weekends,
|
|
53
|
+
and dropped the textX parser in favor of [an ANTLR4 parser grammar](https://github.com/daltskin/sysml-v2-grammar) and
|
|
54
|
+
changed our unit library to pint.
|
|
55
|
+
The project had diverged so much from sysml2py that a new name, sysmlpy, was selected.
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
**v0.12.0:** 100% conformance test pass rate (123/123). Storage abstraction layer with in-memory and NetworkX graph backends. Convenience functions: find_all, count, traverse, to_dict, to_graph, path_between.
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
sysmlpy requires the following Python packages:
|
|
63
|
+
- [pyyaml](https://github.com/yaml/pyyaml)
|
|
64
|
+
- [pint](https://github.com/hgrecco/pint)
|
|
65
|
+
- [antlr4-python3-runtime](https://github.com/antlr/antlr4)
|
|
66
|
+
|
|
67
|
+
### Optional Dependencies
|
|
68
|
+
- [networkx](https://networkx.org/) — graph analysis backend (install with `pip install sysmlpy[graph]`)
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
Multiple installation methods are supported by sysmlpy, including:
|
|
73
|
+
|
|
74
|
+
| **Logo** | **Platform** | **Command** |
|
|
75
|
+
|:-----------------------------------------------------------------:|:------------:|:---------------------------------------------------------------------------------:|
|
|
76
|
+
|  | PyPI | ``python -m pip install sysmlpy`` |
|
|
77
|
+
|  | PyPI | ``python -m pip install sysmlpy[graph]`` (with graph analysis) |
|
|
78
|
+
|  | GitHub | ``python -m pip install https://github.com/mycr0ft/sysmlpy/archive/refs/heads/main.zip`` |
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
Documentation can be found [here.](https://mycr0ft.github.io/sysmlpy/)
|
|
83
|
+
|
|
84
|
+
### Basic Usage
|
|
85
|
+
|
|
86
|
+
The code below will create a part called Stage 1, with a shortname of <'3.1'>
|
|
87
|
+
referencing a specific requirement or document. It has a mass attribute of 100
|
|
88
|
+
kg. It has a thrust attribute of 1000 N. These attributes are created and placed
|
|
89
|
+
as a child of the part. Next, we recall the part value for thrust and add 199 N.
|
|
90
|
+
Finally, we can dump the output from this class.
|
|
91
|
+
```
|
|
92
|
+
from sysmlpy import Attribute, Part, ureg
|
|
93
|
+
|
|
94
|
+
a = Attribute(name='mass')
|
|
95
|
+
a.set_value(100 * ureg.kilogram)
|
|
96
|
+
b = Attribute(name='thrust')
|
|
97
|
+
b.set_value(1000 * ureg.newton)
|
|
98
|
+
c = Part(name="Stage_1", shortname="'3.1'")
|
|
99
|
+
c._set_child(a)
|
|
100
|
+
c._set_child(b)
|
|
101
|
+
v = "Stage_1.thrust"
|
|
102
|
+
c._get_child(v).set_value(c._get_child(v).get_value() + 199 * ureg.newton)
|
|
103
|
+
print(c.dump())
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
It will output the following:
|
|
107
|
+
```
|
|
108
|
+
part <'3.1'> Stage_1 {
|
|
109
|
+
attribute mass= 100 [kilogram];
|
|
110
|
+
attribute thrust= 1199.0 [newton];
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The package is able to handle Items, Parts, and Attributes.
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
a = Part(name='camera')
|
|
118
|
+
b = Item(name='lens')
|
|
119
|
+
d = Attribute(name='mass')
|
|
120
|
+
c = Part(name='sensor')
|
|
121
|
+
c._set_child(a)
|
|
122
|
+
c._set_child(b)
|
|
123
|
+
a._set_child(d)
|
|
124
|
+
print(c.dump())
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
will return:
|
|
128
|
+
```
|
|
129
|
+
part sensor {
|
|
130
|
+
part camera {
|
|
131
|
+
attribute mass;
|
|
132
|
+
}
|
|
133
|
+
item lens;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Actions
|
|
138
|
+
-------
|
|
139
|
+
|
|
140
|
+
Actions (activities) can be defined with input and output parameters::
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
from sysmlpy import Action
|
|
144
|
+
|
|
145
|
+
# Action definition with typed inputs/outputs
|
|
146
|
+
a = Action(definition=True, name='Focus')
|
|
147
|
+
a.add_input('scene', 'Scene')
|
|
148
|
+
a.add_output('image', 'Image')
|
|
149
|
+
print(a.dump())
|
|
150
|
+
# → action def Focus { in scene : Scene; out image : Image; }
|
|
151
|
+
|
|
152
|
+
# Action usage with references
|
|
153
|
+
b = Action(name='TakePicture')
|
|
154
|
+
b.add_input('scene')
|
|
155
|
+
b.add_output('picture')
|
|
156
|
+
print(b.dump())
|
|
157
|
+
# → action TakePicture { in scene; out picture; }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
References
|
|
161
|
+
----------
|
|
162
|
+
|
|
163
|
+
References can reference other elements::
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
from sysmlpy import Reference, Item
|
|
167
|
+
|
|
168
|
+
# Simple reference
|
|
169
|
+
r = Reference(name='driver')
|
|
170
|
+
print(r.dump())
|
|
171
|
+
# → ref driver;
|
|
172
|
+
|
|
173
|
+
# Reference with type
|
|
174
|
+
person = Item(name='Person')
|
|
175
|
+
r2 = Reference(name='driver')
|
|
176
|
+
r2.set_type(person)
|
|
177
|
+
print(r2.dump())
|
|
178
|
+
# → ref driver : Person;
|
|
179
|
+
|
|
180
|
+
# Reference redefinition
|
|
181
|
+
r3 = Reference(name='payload', redefines=True)
|
|
182
|
+
r3.set_type(person)
|
|
183
|
+
print(r3.dump())
|
|
184
|
+
# → ref :>> payload : Person;
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Grammar Round-Trip
|
|
188
|
+
|
|
189
|
+
`loads()` parses SysML v2 text and `classtree()` converts the result back to text. This round-trip is the basis for the grammar test suite.
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
from sysmlpy import loads
|
|
193
|
+
from sysmlpy.formatting import classtree
|
|
194
|
+
|
|
195
|
+
text = """package 'Action Example' {
|
|
196
|
+
action def Focus { in scene : Scene; out image : Image; }
|
|
197
|
+
action def Shoot { in image: Image; out picture : Picture; }
|
|
198
|
+
|
|
199
|
+
action def TakePicture {
|
|
200
|
+
in item scene : Scene;
|
|
201
|
+
out item picture : Picture;
|
|
202
|
+
|
|
203
|
+
bind focus.scene = scene;
|
|
204
|
+
|
|
205
|
+
action focus : Focus { in scene; out image; }
|
|
206
|
+
|
|
207
|
+
flow focus.image to shoot.image;
|
|
208
|
+
|
|
209
|
+
first focus then shoot;
|
|
210
|
+
|
|
211
|
+
action shoot : Shoot { in image; out picture; }
|
|
212
|
+
|
|
213
|
+
bind shoot.picture = picture;
|
|
214
|
+
}
|
|
215
|
+
}"""
|
|
216
|
+
|
|
217
|
+
model = loads(text)
|
|
218
|
+
tree = classtree(model)
|
|
219
|
+
print(tree.dump())
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**61% of the 56 grammar round-trip tests currently pass** (34/56), covering packages, parts, items, ports, interfaces, binding connectors, flow connections, all action forms (definition, shorthand, succession, decomposition), expressions, calculations, and constraints.
|
|
223
|
+
|
|
224
|
+
## Conformance
|
|
225
|
+
|
|
226
|
+
**100% of 123 OMG XPect conformance tests pass** (123/123).
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
sysmlpy is released under the MIT license, hence allowing commercial use of the library.
|
|
230
|
+
|
sysmlpy-0.1.0/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# sysmlpy
|
|
2
|
+
[](https://badge.fury.io/py/sysmlpy)[](https://pypi.python.org/pypi/sysmlpy/)[](https://lbesson.mit-license.org/)
|
|
3
|
+
|
|
4
|
+
## Description
|
|
5
|
+
sysmlpy is an open source pure Python library for constructing python-based
|
|
6
|
+
classes consistent with the [SysML v2.0 standard](https://github.com/Systems-Modeling/SysML-v2-Release).
|
|
7
|
+
|
|
8
|
+
This project began as a fork of the sysml2py project by [Christopher
|
|
9
|
+
Cox](https://github.com/chriscox-westfall). Since April 2026 [Jon Fox](mailto:jon.fox@drfox.com)
|
|
10
|
+
decided to complete coverage of all SysMLv2 features over two months of weekends,
|
|
11
|
+
and dropped the textX parser in favor of [an ANTLR4 parser grammar](https://github.com/daltskin/sysml-v2-grammar) and
|
|
12
|
+
changed our unit library to pint.
|
|
13
|
+
The project had diverged so much from sysml2py that a new name, sysmlpy, was selected.
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
**v0.12.0:** 100% conformance test pass rate (123/123). Storage abstraction layer with in-memory and NetworkX graph backends. Convenience functions: find_all, count, traverse, to_dict, to_graph, path_between.
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
sysmlpy requires the following Python packages:
|
|
21
|
+
- [pyyaml](https://github.com/yaml/pyyaml)
|
|
22
|
+
- [pint](https://github.com/hgrecco/pint)
|
|
23
|
+
- [antlr4-python3-runtime](https://github.com/antlr/antlr4)
|
|
24
|
+
|
|
25
|
+
### Optional Dependencies
|
|
26
|
+
- [networkx](https://networkx.org/) — graph analysis backend (install with `pip install sysmlpy[graph]`)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Multiple installation methods are supported by sysmlpy, including:
|
|
31
|
+
|
|
32
|
+
| **Logo** | **Platform** | **Command** |
|
|
33
|
+
|:-----------------------------------------------------------------:|:------------:|:---------------------------------------------------------------------------------:|
|
|
34
|
+
|  | PyPI | ``python -m pip install sysmlpy`` |
|
|
35
|
+
|  | PyPI | ``python -m pip install sysmlpy[graph]`` (with graph analysis) |
|
|
36
|
+
|  | GitHub | ``python -m pip install https://github.com/mycr0ft/sysmlpy/archive/refs/heads/main.zip`` |
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
Documentation can be found [here.](https://mycr0ft.github.io/sysmlpy/)
|
|
41
|
+
|
|
42
|
+
### Basic Usage
|
|
43
|
+
|
|
44
|
+
The code below will create a part called Stage 1, with a shortname of <'3.1'>
|
|
45
|
+
referencing a specific requirement or document. It has a mass attribute of 100
|
|
46
|
+
kg. It has a thrust attribute of 1000 N. These attributes are created and placed
|
|
47
|
+
as a child of the part. Next, we recall the part value for thrust and add 199 N.
|
|
48
|
+
Finally, we can dump the output from this class.
|
|
49
|
+
```
|
|
50
|
+
from sysmlpy import Attribute, Part, ureg
|
|
51
|
+
|
|
52
|
+
a = Attribute(name='mass')
|
|
53
|
+
a.set_value(100 * ureg.kilogram)
|
|
54
|
+
b = Attribute(name='thrust')
|
|
55
|
+
b.set_value(1000 * ureg.newton)
|
|
56
|
+
c = Part(name="Stage_1", shortname="'3.1'")
|
|
57
|
+
c._set_child(a)
|
|
58
|
+
c._set_child(b)
|
|
59
|
+
v = "Stage_1.thrust"
|
|
60
|
+
c._get_child(v).set_value(c._get_child(v).get_value() + 199 * ureg.newton)
|
|
61
|
+
print(c.dump())
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
It will output the following:
|
|
65
|
+
```
|
|
66
|
+
part <'3.1'> Stage_1 {
|
|
67
|
+
attribute mass= 100 [kilogram];
|
|
68
|
+
attribute thrust= 1199.0 [newton];
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The package is able to handle Items, Parts, and Attributes.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
a = Part(name='camera')
|
|
76
|
+
b = Item(name='lens')
|
|
77
|
+
d = Attribute(name='mass')
|
|
78
|
+
c = Part(name='sensor')
|
|
79
|
+
c._set_child(a)
|
|
80
|
+
c._set_child(b)
|
|
81
|
+
a._set_child(d)
|
|
82
|
+
print(c.dump())
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
will return:
|
|
86
|
+
```
|
|
87
|
+
part sensor {
|
|
88
|
+
part camera {
|
|
89
|
+
attribute mass;
|
|
90
|
+
}
|
|
91
|
+
item lens;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Actions
|
|
96
|
+
-------
|
|
97
|
+
|
|
98
|
+
Actions (activities) can be defined with input and output parameters::
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
from sysmlpy import Action
|
|
102
|
+
|
|
103
|
+
# Action definition with typed inputs/outputs
|
|
104
|
+
a = Action(definition=True, name='Focus')
|
|
105
|
+
a.add_input('scene', 'Scene')
|
|
106
|
+
a.add_output('image', 'Image')
|
|
107
|
+
print(a.dump())
|
|
108
|
+
# → action def Focus { in scene : Scene; out image : Image; }
|
|
109
|
+
|
|
110
|
+
# Action usage with references
|
|
111
|
+
b = Action(name='TakePicture')
|
|
112
|
+
b.add_input('scene')
|
|
113
|
+
b.add_output('picture')
|
|
114
|
+
print(b.dump())
|
|
115
|
+
# → action TakePicture { in scene; out picture; }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
References
|
|
119
|
+
----------
|
|
120
|
+
|
|
121
|
+
References can reference other elements::
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
from sysmlpy import Reference, Item
|
|
125
|
+
|
|
126
|
+
# Simple reference
|
|
127
|
+
r = Reference(name='driver')
|
|
128
|
+
print(r.dump())
|
|
129
|
+
# → ref driver;
|
|
130
|
+
|
|
131
|
+
# Reference with type
|
|
132
|
+
person = Item(name='Person')
|
|
133
|
+
r2 = Reference(name='driver')
|
|
134
|
+
r2.set_type(person)
|
|
135
|
+
print(r2.dump())
|
|
136
|
+
# → ref driver : Person;
|
|
137
|
+
|
|
138
|
+
# Reference redefinition
|
|
139
|
+
r3 = Reference(name='payload', redefines=True)
|
|
140
|
+
r3.set_type(person)
|
|
141
|
+
print(r3.dump())
|
|
142
|
+
# → ref :>> payload : Person;
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Grammar Round-Trip
|
|
146
|
+
|
|
147
|
+
`loads()` parses SysML v2 text and `classtree()` converts the result back to text. This round-trip is the basis for the grammar test suite.
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from sysmlpy import loads
|
|
151
|
+
from sysmlpy.formatting import classtree
|
|
152
|
+
|
|
153
|
+
text = """package 'Action Example' {
|
|
154
|
+
action def Focus { in scene : Scene; out image : Image; }
|
|
155
|
+
action def Shoot { in image: Image; out picture : Picture; }
|
|
156
|
+
|
|
157
|
+
action def TakePicture {
|
|
158
|
+
in item scene : Scene;
|
|
159
|
+
out item picture : Picture;
|
|
160
|
+
|
|
161
|
+
bind focus.scene = scene;
|
|
162
|
+
|
|
163
|
+
action focus : Focus { in scene; out image; }
|
|
164
|
+
|
|
165
|
+
flow focus.image to shoot.image;
|
|
166
|
+
|
|
167
|
+
first focus then shoot;
|
|
168
|
+
|
|
169
|
+
action shoot : Shoot { in image; out picture; }
|
|
170
|
+
|
|
171
|
+
bind shoot.picture = picture;
|
|
172
|
+
}
|
|
173
|
+
}"""
|
|
174
|
+
|
|
175
|
+
model = loads(text)
|
|
176
|
+
tree = classtree(model)
|
|
177
|
+
print(tree.dump())
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**61% of the 56 grammar round-trip tests currently pass** (34/56), covering packages, parts, items, ports, interfaces, binding connectors, flow connections, all action forms (definition, shorthand, succession, decomposition), expressions, calculations, and constraints.
|
|
181
|
+
|
|
182
|
+
## Conformance
|
|
183
|
+
|
|
184
|
+
**100% of 123 OMG XPect conformance tests pass** (123/123).
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
sysmlpy is released under the MIT license, hence allowing commercial use of the library.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
#requires = ["setuptools>=61.0"]
|
|
3
|
+
#build-backend = "setuptools.build_meta"
|
|
4
|
+
requires = ["poetry-core"]
|
|
5
|
+
build-backend = "poetry.core.masonry.api"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "sysmlpy"
|
|
9
|
+
version = "0.1.0"
|
|
10
|
+
description = "SysML v2.0 Parser"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name="Jon R. Fox (mycr0ft)", email="jon.fox@drfox.com" },
|
|
13
|
+
]
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
license = {file = "LICENSE"}
|
|
16
|
+
requires-python = ">=3.7"
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
"Homepage" = "https://github.com/Westfall-io/sysmlpy"
|
|
26
|
+
"Bug Tracker" = "https://github.com/Westfall-io/sysmlpy/issues"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
[tool.setuptools]
|
|
31
|
+
include-package-data = true
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src/sysmlpy", "src"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
grammar = ["*.tx"]
|
|
38
|
+
"sysmlpy" = [
|
|
39
|
+
"library/**/*.sysml",
|
|
40
|
+
"library/**/*.kerml",
|
|
41
|
+
"library/LICENSE",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
pythonpath = [
|
|
47
|
+
"src"
|
|
48
|
+
]
|
|
49
|
+
markers = [
|
|
50
|
+
"conformance: SysML v2 Pilot Implementation 2026-03 parse conformance tests (deselect with '-m not conformance')",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
[tool.semantic_release]
|
|
55
|
+
version_variable = [
|
|
56
|
+
"src/sysmlpy/__init__.py:version",
|
|
57
|
+
]
|
|
58
|
+
version_toml=[
|
|
59
|
+
"pyproject.toml:tool.poetry.version",
|
|
60
|
+
"pyproject.toml:project.version",
|
|
61
|
+
]
|
|
62
|
+
commit_parser = "emoji"
|
|
63
|
+
build_command = "pip install poetry && poetry build"
|
|
64
|
+
commit_message = ":bookmark:{version}\n\nAutomatically generated by python-semantic-release"
|
|
65
|
+
|
|
66
|
+
[tool.semantic_release.changelog]
|
|
67
|
+
exclude_commit_patterns = [":robot:",":twisted_rightwards_arrows:",
|
|
68
|
+
":poop:", "^[^:].*"]
|
|
69
|
+
|
|
70
|
+
[tool.semantic_release.commit_parser_options]
|
|
71
|
+
major_tags = [":boom:"]
|
|
72
|
+
minor_tags = [
|
|
73
|
+
":sparkles:",
|
|
74
|
+
":children_crossing:",
|
|
75
|
+
":lipstick:",
|
|
76
|
+
":iphone:",
|
|
77
|
+
":egg:",
|
|
78
|
+
":chart_with_upwards_trend:",
|
|
79
|
+
]
|
|
80
|
+
patch_tags = [
|
|
81
|
+
":ambulance:",
|
|
82
|
+
":lock:",
|
|
83
|
+
":bug:",
|
|
84
|
+
":zap:",
|
|
85
|
+
":goal_net:",
|
|
86
|
+
":alien:",
|
|
87
|
+
":wheelchair:",
|
|
88
|
+
":speech_balloon:",
|
|
89
|
+
":mag:",
|
|
90
|
+
":apple:",
|
|
91
|
+
":penguin:",
|
|
92
|
+
":checkered_flag:",
|
|
93
|
+
":robot:",
|
|
94
|
+
":green_apple:",
|
|
95
|
+
":memo:",
|
|
96
|
+
":heavy_plus_sign:",
|
|
97
|
+
":construction:",
|
|
98
|
+
":white_check_mark:",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
[tool.semantic_release.branches.main]
|
|
102
|
+
match = "(main|master)"
|
|
103
|
+
prerelease = false
|
|
104
|
+
build_command = "pip install poetry && poetry build"
|
|
105
|
+
|
|
106
|
+
[tool.semantic_release.branches."dev0.5.x"]
|
|
107
|
+
match = "dev0.5.x"
|
|
108
|
+
prerelease = true
|
|
109
|
+
prerelease_token = "rc"
|
|
110
|
+
build_command = "pip install poetry && poetry build"
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
[tool.poetry]
|
|
114
|
+
name = "sysmlpy"
|
|
115
|
+
version = "0.1.0"
|
|
116
|
+
description = ""
|
|
117
|
+
authors = ["Jon R. Fox (mycr0ft) <jon.fox@drfox.com>"]
|
|
118
|
+
readme = "README.md"
|
|
119
|
+
packages = [{ include = "sysmlpy", from = "src" }]
|
|
120
|
+
|
|
121
|
+
[tool.poetry.dependencies]
|
|
122
|
+
python = "^3.9"
|
|
123
|
+
pint = ">=0.24"
|
|
124
|
+
pyyaml = ">=6.0"
|
|
125
|
+
antlr4-python3-runtime = ">=4.13"
|
|
126
|
+
networkx = { version = ">=3.0", optional = true }
|
|
127
|
+
|
|
128
|
+
[tool.poetry.extras]
|
|
129
|
+
graph = ["networkx"]
|
|
130
|
+
|
|
131
|
+
[tool.poetry.scripts]
|
|
132
|
+
sysmlpy = "sysmlpy.__main__:main"
|
|
133
|
+
|
|
134
|
+
[tool.poetry.group.dev.dependencies]
|
|
135
|
+
pytest = ">=8.0,<9.0"
|
|
136
|
+
|