syside.Environment
- class Environment(documents: list[syside.SharedMutex[syside.Document]], index: syside.StaticIndex, lib: syside.Stdlib, result: syside.ExecutionResult | None)
Standard library environment for use with user models.
Initialization
- documents: list[syside.SharedMutex[syside.Document]] = None
Documents in this environment
- lib: syside.Stdlib = None
Standard library cache
- result: syside.ExecutionResult | None = None
Result of parsing documents in this environment
- classmethod get_default() syside.Environment
Get a default constructed standard library environment. This will only be executed on the first call, and any subsequent calls will return a cached value. Standard library environment is cached based on the assumption that it WILL NOT change during runtime, saving resources when loading other models.
- classmethod from_stdlib_files(stdlib_files: list[pathlib.Path]) syside.Environment
Construct the environment from the given stdlib files.
- Parameters:
stdlib_files – The paths to SysMLv2 or KerML files representing the stdlib. These files must have correct file extensions (
.sysml
or.kerml
).
- classmethod from_documents(documents: Iterable[syside.SharedMutex[syside.Document]], index: syside.StaticIndex | None = None) syside.Environment
Construct the environment from the given documents.
- Parameters:
documents – The documents from which to construct the SysMLv2 environment.
index – The index to be used in models. If
None
, creates a new index. If notNone
, clones the index to avoid mutating the argument.
- index() syside.StaticIndex
Returns a copy of the environment index for use in dependent models. A copy is required so that dependent models do not affect this environment and other dependent models.