windtrader
windtrader 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
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 must be available on your system (CI uses Temurin JDK).
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/ValidationResultare nowwindtrader.client/WindtraderClient/CommandResult. The module drivescheck,echo, and nowexport, so the old "validator" name was misleading. Update imports fromwindtrader.validatortowindtrader.clientand 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)
CommandResult
Returned objects include:
ok: boolean success flagexit_code: Java exit codestdout/stderr: raw tool outputjar_path: cached JAR locationduration_s: execution timeis_invalid_syntaxis_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.
Configuration
Environment variables:
WINDTRADER_CACHE_DIR– override JAR cache directoryWINDTRADER_JAVA_REPO– override GitHub repo for JAR downloadsWINDTRADER_JAVA_STABLE_ASSET– explicit asset URL (optional)
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sysml_windtrader-0.2.1.tar.gz | 27.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sysml_windtrader-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.9 kB
Release files / sysml_windtrader-0.2.1.tar.gz
| Download URL | sysml_windtrader-0.2.1.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9f78ad70b6274e0fc26ccd2dd031e823ba161c60913e051b3379e3c8c21eec9
|
|
BLAKE2b-256 checksum How to use checksums |
676b5ac71b61efc5d456e097fe03be63b331b63b3e23473edd367d52fa65c164
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / sysml_windtrader-0.2.1-py3-none-any.whl
| Download URL | sysml_windtrader-0.2.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4db4c7c2ebc7a84e982e178c5e4fbf4d276f1ace922027a742001899e88c2dc
|
|
BLAKE2b-256 checksum How to use checksums |
a5fd4fae9719e76202a3865c24c65357700348f4513c18ee1bab3789e184d382
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|