Skip to main content

sysml2py

PyPI versionPyPI statusCoverage StatusDocstring CoverageMIT license

Trello

Description

sysml2py is an open source pure Python library for constructing python-based classes consistent with the SysML v2.0 standard.

Requirements

sysml2py requires the following Python packages:

Installation

Multiple installation methods are supported by sysml2py, including:

Logo Platform Command
PyPI logo PyPI python -m pip install sysml2py
GitHub logo GitHub python -m pip install https://github.com/Westfall-io/sysml2py/archive/refs/heads/main.zip

Documentation

Documentation can be found here.

Basic Usage

The code below will create a part called Stage 1, with a shortname of <'3.1'> referencing a specific requirement or document. It has a mass attribute of 100 kg. It has a thrust attribute of 1000 N. These attributes are created and placed as a child of the part. Next, we recall the part value for thrust and add 199 N. Finally, we can dump the output from this class as grammar output and load it into the classtree function which takes the initial grammar and converts it into classes which correctly format the output.

  from sysml2py.formatting import classtree
  from sysml2py import Attribute, Part

  import astropy.units as u
  a = Attribute()._set_name('mass')
  a.set_value(100*u.kg)
  b = Attribute()._set_name('thrust')
  b.set_value(1000*u.N)
  c = Part()._set_name("Stage_1")._set_name("'3.1'", short=True)
  c._set_child(a)
  c._set_child(b)
  v = "Stage_1.thrust"
  c._get_child(v).set_value(c._get_child(v).get_value()+199*u.N)
  print(classtree(c.dump()).dump())

It will output the following, which isn't yet fully correct as we need to import the SI units to be valid SysML.

  part <'3.1'> Stage_1 {
    attribute mass= 100.0 [kg];
    attribute thrust= 1199.0 [N];
  }

The package is able to handle Items, Parts, and Attributes.

a = Part()._set_name('camera')
b = Item()._set_name('lens')
d = Attribute()._set_name('mass')
c = Part()._set_name("sensor")
c._set_child(a)
c._set_child(b)
a._set_child(d)
print(classtree(c.dump()).dump())

will return:

part sensor {
   part camera {
      attribute mass;
   }
   item lens;
}

Release Planning

Development can be tracked via Trello.

License

sysml2py is released under the MIT license, hence allowing commercial use of the library.

Metadata

Release files for sysml2py 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sysml2py 0.5.3
File Size Uploaded
sysml2py-0.5.3.tar.gz 73.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sysml2py 0.5.3
File Interpreter ABI Platform
sysml2py-0.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 153.3 kB

Release files / sysml2py-0.5.3.tar.gz

Download URL sysml2py-0.5.3.tar.gz
Size 73.8 kB
Tags Source
SHA-256 checksum
How to use checksums
500fe7a63c01ac02d224f5903395641c9a45a3ce34315f83fb93ab208369dab2
BLAKE2b-256 checksum
How to use checksums
0b2003fc7d4a6a62679771e5ec218884160b6fa8b1e3bcd1cfc640e7c4979ec7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / sysml2py-0.5.3-py3-none-any.whl

Download URL sysml2py-0.5.3-py3-none-any.whl
Size 79.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d672faf110c3876e9fd678b75724b9035ea2b1144e9716b3bfae51dbae4379f1
BLAKE2b-256 checksum
How to use checksums
5135e079ff4634494b2c11cbd70670327b820fc0db1340af4db8a10b6447f490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files

0.5.2

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.2.10

2 release files

0.2.5

2 release files

0.2.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page