preview Labs
Module implementing various proposals for how to make the Syside API more convenient and easier to pick up.
Index
Classes
A SysML v2/KerML model interface. Top level elements (typically Packages) can be accessed
through the |
||
A SysML v2/KerML model that needs to be |
Functions
Opens an empty model, loading only standard library elements (unless |
||
Opens a model stored in |
||
Opens a model stored in |
||
Reload a model, recomputing all derived elements. |
Functions
- empty_model(*, warnings_as_errors: bool = False, allow_errors: bool = False, include_stdlib: bool = True, environment: syside.Environment | None = None) syside.preview.LockedModel
Opens an empty model, loading only standard library elements (unless
include_stdlib=False).unlockthe returned model before sharing between threads (and re-lock before use), or use awith-block to automatically unlock when exiting the block.- Parameters:
warnings_as_errors – if True, warnings are treated errors
allow_errors – if True, tries to return a partial or invalid model even in the presence of errors
include_stdlib – if False, tries to load the model without also loading the SysML v2 standard library
environment – The environment to be used for the model. If this parameter is
None, the default environment is used.
- Returns:
a
LockedModelrepresenting an empty model.
- open_model(paths: pathlib.Path | str | Iterable[pathlib.Path | str], *, warnings_as_errors: bool = False, allow_errors: bool = False, include_stdlib: bool = True, environment: syside.Environment | None = None, attach_comments: bool = False) syside.preview.LockedModel
Opens a model stored in
paths, which can be given as a (combination of) file and directory paths. By default the model is allowed to generate warnings (warnings_as_errors) but is not allowed to contain errors (allow_errors).unlockthe returned model before sharing between threads (and re-lock before use), or use awith-block to automatically unlock when exiting the block.- Parameters:
paths – path or sequence of paths (given as
strorPath) of source files, or directories containing source files, to be included in the modelwarnings_as_errors – if True, warnings are treated errors
allow_errors – if True, tries to return a partial or invalid model even in the presence of errors
include_stdlib – if False, tries to load the model without also loading the SysML v2 standard library
environment – The environment to be used for the model. If this parameter is
None, the default environment is used.attach_comments – if
True, source notes are attached to the model and preserved on formatting the model back to text
- Returns:
a
LockedModelrepresenting the model loaded from source files given inpaths- Raises:
syside.ModelError – if model contains errors and
allow_errorsis False
- open_model_unlocked(paths: pathlib.Path | str | Iterable[pathlib.Path | str], *, warnings_as_errors: bool = False, allow_errors: bool = False, include_stdlib: bool = True, environment: syside.Environment | None = None, attach_comments: bool = False) syside.preview.UnlockedModel
Opens a model stored in
paths, which can be given as a (combination of) file and directory paths. By default the model is allowed to generate warnings (warnings_as_errors) but is not allowed to contain errors (allow_errors).lockthe returned model before access- Parameters:
paths – path or sequence of paths (given as
strorPath) of source files, or directories containing source files, to be included in the modelwarnings_as_errors – if True, warnings are treated errors
allow_errors – if True, tries to return a partial or invalid model even in the presence of errors
include_stdlib – if False, tries to load the model without also loading the SysML v2 standard library
environment – The environment to be used for the model. If this parameter is
None, the default environment is used.attach_comments – if
True, source notes are attached to the model and preserved on formatting the model back to text
- Returns:
an
UnlockedModelrepresenting the model loaded from source files given inpaths- Raises:
syside.ModelError – if model contains errors and
allow_errorsis False
- reload_model(m: syside.Model) tuple[list[syside.DiagnosticMessage], list[syside.Diagnostic]]
Reload a model, recomputing all derived elements.
If deserialization fails,
mis left unchanged.- Parameters:
m – The model to reload.
- Returns:
A tuple of (serde messages, pipeline diagnostics). Serde messages are produced during JSON deserialization. Pipeline diagnostics are sema and validation diagnostics produced by re-running the pipeline.
- Raises:
syside.json.ProjectDeserializationError – If deserialization fails.