Skip to main content

SysML v2 textual notation style checker and formatter

Project description

sysml-style

SysML v2 textual notation style checker and formatter. Lints and auto-formats .sysml files using configurable rules.

Installation

pip install sysmlpy        # required dependency
pip install tomli           # optional — only needed on Python < 3.11 for pyproject.toml config

Then run from the project root:

python -m sysml_style --help

Or install the package in editable mode:

pip install -e .
sysml-style --help

Usage

sysml-style check  [OPTIONS] FILE [FILE ...]
sysml-style format [OPTIONS] FILE [FILE ...]

check — Lint files for style issues

sysml-style check uav.sysml
sysml-style check --ignore SML401,SML202 uav.sysml
sysml-style check --quiet uav.sysml

Issues are printed as:

file.sysml:3:5: SML101 expected spaces around '=' operator [fixable]

Exit code: 0 if no issues, 1 if issues found.

format — Auto-format files

sysml-style format uav.sysml        # rewrites in-place
sysml-style format --check uav.sysml  # exit 1 if would change (for CI)
sysml-style format --diff uav.sysml   # show unified diff, don't write
sysml-style format --quiet uav.sysml

Exit code: 0 if no changes, 1 if --check would reformat, 2 on parse errors.

Config

Create a [tool.sysml-style] section in your pyproject.toml:

[tool.sysml-style]
max_line_length = 120
indent_size = 4
ignore = ["SML401", "SML202"]
naming_convention = "strict"   # or "relaxed"

sysml-style walks up from the target file to find pyproject.toml. Use --config PATH to point to a specific file. Without a config file, sensible defaults are used.

Rules

SML1xx — Whitespace

Code Rule Fixable
SML101 Spaces around = operator yes
SML102 No space before ; yes
SML103 No trailing whitespace yes
SML104 Indentation is a multiple of the detected unit (2/3/4 spaces) no
SML105 Blank line between top-level definitions yes
SML106 Space before { yes

SML2xx — Naming

Code Rule Fixable
SML201 Definition names should be UpperCamelCase no
SML202 Usage (feature) names should be lowerCamelCase no
SML203 Port names should end with Port suffix no
SML204 Avoid spaces in element names; use CamelCase ⚠️ no

In relaxed naming mode, single-quoted names like 'My Part' are allowed without case enforcement.

⚠️ SML204 is a warning-level rule. Some organizations use spaces in quoted names for readability. Add --ignore SML204 if this doesn't fit your workflow.

SML3xx — Structure

Code Rule Fixable
SML301 import/alias before definitions no
SML302 Empty block body {} can be omitted no
SML303 Filename matches outermost package name ⚠️ no
SML304 Usages should have a descriptive name (no anonymous usages) no
SML305 import must have a visibility parameter (public/private/protected) yes

⚠️ SML303 is a warning-level rule. Filename conventions vary across organizations — some use snake_case.sysml, others mirror the package name exactly. Add --ignore SML303 or set ignore = ["SML303"] in your config if the rule doesn't fit your workflow.

SML305 is fixable — the fix adds public before the import, which is the safest default visibility.

SML4xx — Idioms

Code Rule Fixable
SML401 Doc comment before element, not after ; no
SML402 Use doc keyword for documentation comments no

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sysml_style-0.3.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sysml_style-0.3.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file sysml_style-0.3.1.tar.gz.

File metadata

  • Download URL: sysml_style-0.3.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sysml_style-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e3ccdaab74620c83cbb26f576a44f706be0c18ec1ef7ab6ef426a5a09e16c73a
MD5 3f2f98e44958eaf4c7c95440f6e0e48e
BLAKE2b-256 0cd2a29d991212fa5ee52dba1c1e18ff2496d78242c7b9b7d089b50fa769785e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sysml_style-0.3.1.tar.gz:

Publisher: python-publish.yml on mycr0ft/sysml-style

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sysml_style-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: sysml_style-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sysml_style-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abf17ea17ad51604df0a4ccddfee57e8389c52f36afdc07bef52700aab0e6984
MD5 e88fe6e90200d20dc1730963c6c3300a
BLAKE2b-256 16eb97447306d590f86f3ae2761dd9a3bc4bbe3bea918a99bef807c1c8952d75

See more details on using hashes here.

Provenance

The following attestation bundles were made for sysml_style-0.3.1-py3-none-any.whl:

Publisher: python-publish.yml on mycr0ft/sysml-style

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page