Environment

class Environment

Standard library environment for use with user models.

Members defined in Environment (7 members)

documents

RW

Documents in this environment

lib

RW

Standard library cache

result

RW

Result of parsing documents in this environment

from_documents

Construct the environment from the given documents.

from_stdlib_files

Construct the environment from the given stdlib files.

get_default

Get a default constructed standard library environment.

index

Returns a copy of the environment index for use in dependent models.

Attributes

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

Methods

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 not None, clones the index to avoid mutating the argument.

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 get_default(root: pathlib.Path | None = None) 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.

The additional root argument may be used to initialize the default environment to another standard library under root / sysml.library. Note that this only has effect on the very first call of get_default — call this on the program startup.

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.

Used in