Skip to main content

sysml-windtrader

sysml-windtrader (windtrader on import) is a lightweight Python wrapper around the windtrader-java SysML v2 validator. It provides a simple, scriptable way to validate SysML v2 textual syntax from Python while delegating all grammar authority to the official Java-based validator.

This project is intentionally parse-only: it validates syntax, reports diagnostics, and (optionally) echoes parsed output, but does not perform semantic resolution or model linking.


Status

CI Coverage Docstrings Python License


Key Features

  • ✅ Validates SysML v2 textual syntax using a pinned Java validator
  • 🧩 Thin, explicit Python API (no hidden model interpretation)
  • 📦 Automatic download and caching of the validator JAR
  • 🧪 Designed for CI, generators, and downstream tooling
  • 🔐 Stable exit-code contract from Java → Python

Installation

pip install sysml-windtrader

Or for development:

pip install -e ".[dev]"

Java requirement: the default windtrader-java release (0.2.x) is compiled for Java 21 (class file version 65). Java 21 or newer must be available on your system (CI uses Temurin JDK 21). If your default java is older, point the wrapper at a Java 21+ JVM via WINDTRADER_JAVA (explicit executable path) or JAVA_HOME — see Configuration.


Command-Line Usage

echo "part { attribute mass; }" | windtrader           # validate (default: check)
echo "part { attribute mass; }" | windtrader export     # print element JSON graph

Subcommands:

check    (default) parse-validate SysML text
echo     print the normalized/echoed representation
export   parse SysML and print the SysMLv2 element JSON graph (API shape)

Options:

--version            Show windtrader package version
--java-version       windtrader-java version to use (default: 0.2.0)
--timeout            Subprocess timeout (default: 10s for check/echo, 120s for export)

The CLI forwards stdout/stderr directly from the Java tool and exits with the same exit code.


Python API

0.2.0 rename: windtrader.validator (module) / WindtraderValidator / ValidationResult are now windtrader.client / WindtraderClient / CommandResult. The module drives check, echo, and now export, so the old "validator" name was misleading. Update imports from windtrader.validator to windtrader.client and the class/type names accordingly.

# before (0.1.x)
from windtrader.validator import WindtraderValidator, ValidationResult
# after (0.2.0)
from windtrader.client import WindtraderClient, CommandResult

Basic validation

from windtrader import validate

result = validate("part { attribute mass; }")

if result.ok:
    print("Valid SysML")
else:
    print("Invalid:", result.stderr)

Client object

from windtrader import WindtraderClient

client = WindtraderClient(version="0.2.0")
res = client.validate("part { attrib mass; }")

print(res.exit_code)  # 0 = valid, 2 = syntax error, 3 = runtime error

Export

from windtrader import export

res = export("part { attribute mass; }")

if res.ok:
    print(res.stdout)  # SysMLv2 element JSON graph (array of API-shaped elements)
else:
    print("Failed:", res.stderr)

Validate across versions

from windtrader import validate_across_versions

results = validate_across_versions("part { attribute mass; }", versions=["0.2.0"])

# One CommandResult per version, in the order given.
for r in results:
    print(r.version, "->", "valid" if r.ok else "invalid")

CommandResult

Returned objects include:

  • ok: boolean success flag
  • exit_code: Java exit code
  • stdout / stderr: raw tool output
  • jar_path: cached JAR location
  • duration_s: execution time
  • is_invalid_syntax
  • is_runtime_error

Exit Code Contract

The Java validator defines:

Exit Code Meaning
0 Valid syntax
2 Invalid SysML
3 Runtime error

Python preserves these codes exactly. Any process exit code outside (0, 2, 3) — for example the JVM's own startup failure code (1) when an old Java hits a Java-21-compiled JAR — is normalized to 3 (runtime error), so the contract never leaks a foreign code. The underlying JVM detail is kept on stderr (e.g. UnsupportedClassVersionError ... class file version 65.0 ... only recognizes ... 62.0).

In the Python API, CommandResult.exit_code is always one of 0/2/3; is_invalid_syntax is exit_code == 2 and is_runtime_error is exit_code not in (0, 2) (i.e. 3).


Configuration

Environment variables:

  • WINDTRADER_CACHE_DIR – override JAR cache directory
  • WINDTRADER_JAVA_REPO – override GitHub repo for JAR downloads
  • WINDTRADER_JAVA_STABLE_ASSET – explicit asset URL (optional)
  • WINDTRADER_JAVA – explicit path to a java executable (or a JVM launcher) to use instead of java on PATH. Handy on machines whose default Java is too old for the target JAR — set it to a Java 21+ executable.
  • JAVA_HOME – if set (and WINDTRADER_JAVA is not), the wrapper uses <JAVA_HOME>/bin/java as the Java executable.

Java executable resolution order: WINDTRADER_JAVA → JAVA_HOME/bin/java → java on PATH.


Design Philosophy

  • Grammar is authoritative: validation truth lives in Java
  • Python is orchestration only
  • No silent fallbacks
  • Reproducible CI behavior

This makes windtrader suitable as a foundation for:

  • Code generators
  • Corpus analysis
  • Model-building libraries
  • CI validation gates

Relationship to Other Projects

windtrader is designed to act as the validation backbone for higher-level SysML tooling, including programmatic builders and corpus-driven API generation pipelines.


License

MIT License. See LICENSE.


Contributing

Pull requests welcome. Please ensure:

  • CI passes
  • Docstring coverage remains high
  • Backend version bumps are intentional

Metadata

Release files for sysml-windtrader 0.2.4

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

Source distribution (sdist)

Source distribution for sysml-windtrader 0.2.4
File Size Uploaded Provenance Actions
sysml_windtrader-0.2.4.tar.gz 29.5 kB Without provenance Details for sysml_windtrader-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sysml-windtrader 0.2.4
File Interpreter ABI Platform Actions
sysml_windtrader-0.2.4-py3-none-any.whl Python 3 none any Details for sysml_windtrader-0.2.4-py3-none-any.whl

Total release size: 43.2 kB

Release files / sysml_windtrader-0.2.4.tar.gz

Download URL sysml_windtrader-0.2.4.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bde5963d4b6ba31a42112f6bf4d24631a6dec06359669150ae5fce907d51d15d
BLAKE2b-256 checksum
How to use checksums
40aeea63f706410cd852e3c35dbdc578a7443e26a183ba3a4b649b938b79ddd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / sysml_windtrader-0.2.4-py3-none-any.whl

Download URL sysml_windtrader-0.2.4-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7af48a86b0ef41337ac1ea38f1fd50976a85f9353a50b76331716ca30ad6f03d
BLAKE2b-256 checksum
How to use checksums
1fa46af0cd7da86e2d19ed5953efe087ac04a92b66ed851c1e51cd79a10ab42c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for sysml-windtrader 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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