blark.dependency_store.DependencyStore

class blark.dependency_store.DependencyStore(root: Path)[source]

Bases: object

A storage container for dependency configuration and loading.

Environment variable: BLARK_TWINCAT_ROOT is required to be set for this to be functional, along with a “config.json” in that directory. This should contain information as to the supported library dependencies and where to find them.

{
    "libraries": {
        "LCLS General": {
            "name": "LCLS General",
            "versioned": false,
            "path": "lcls-twincat-general",
            "project": "LCLSGeneral.sln"
        },
        "lcls-twincat-motion": {
            "name": "lcls-twincat-motion",
            "versioned": true,
            "path": "lcls-twincat-motion",
            "project": "lcls-twincat-motion.sln"
        }
    }
}

The above would indicate that the “LCLS General” library (as named in TwinCAT) is available relative to the root directory in lcls-twincat-general/LCLSGeneral.sln. It would also indicate that the “lcls-twincat-motion” library could be found in lcls-twincat-motion/VERSION/lcls-twincat-motion.sln where VERSION is the project-defined version.

Methods

__init__(root)

get_dependencies(plc)

Get dependency projects from a PLC.

get_dependency(name[, version])

Get a dependency by name and version number.

get_instance()

Get the global DependencyStore instance.

load_config()

Load the dependency store configuration file.

Attributes

config_filename

The configuration filename.

root

config

config: DependencyStoreConfig
__init__(root: Path)[source]
root: Path
property config_filename

The configuration filename.

load_config()[source]

Load the dependency store configuration file.

get_dependency(name: str, version: str | None = None) List[PlcProjectMetadata][source]

Get a dependency by name and version number.

get_dependencies(plc: TwincatPlcProject) Generator[Tuple[DependencyVersion, PlcProjectMetadata], None, None][source]

Get dependency projects from a PLC.

static get_instance() DependencyStore[source]

Get the global DependencyStore instance.