OpenAssetIO
An abstract API for generalising interactions between a host application and an asset management system
|
Loads Python Packages, using entry point discovery or from a custom search path. More...
Public Member Functions | |
def | __init__ (self, logger) |
def | reset (self) |
Clears any previously loaded plugins. More... | |
def | scan (self, paths) |
Searches the supplied paths for modules that define a PythonPluginSystemPlugin through a top-level openassetioPlugin variable. More... | |
def | scan_entry_points (self, entryPointName) |
Searches packages for entry points that define a PythonPluginSystemPlugin through a top-level openassetioPlugin variable. More... | |
def | identifiers (self) |
Returns the identifiers known to the plugin system. More... | |
def | plugin (self, identifier) |
Retrieves the plugin that provides the given identifier. More... | |
def | register (self, cls, path="<unknown>") |
Allows manual registration of a PythonPluginSystemPlugin derived class. More... | |
Loads Python Packages, using entry point discovery or from a custom search path.
If they manager a top-level 'plugin' attribute, that holds a class derived from PythonPluginSystemPlugin, it will be registered with its identifier. Once a plug-in has registered an identifier, any subsequent registrations with that id will be skipped.
def __init__ | ( | self, | |
logger | |||
) |
def identifiers | ( | self | ) |
Returns the identifiers known to the plugin system.
If scan has not been called, then this will be empty.
List[str]
def plugin | ( | self, | |
identifier | |||
) |
Retrieves the plugin that provides the given identifier.
errors.InputValidationException | Raised if no plugin provides the specified identifier. |
def register | ( | self, | |
cls, | |||
path = "<unknown>" |
|||
) |
Allows manual registration of a PythonPluginSystemPlugin derived class.
This can be used to register plugins using means other than the built-in file system scanning.
cls | PythonPluginSystemPlugin |
path | str Some reference to where this plugin originated, used for debug messaging when duplicate registrations of the same identifier are encountered. |
def reset | ( | self | ) |
Clears any previously loaded plugins.
def scan | ( | self, | |
paths | |||
) |
Searches the supplied paths for modules that define a PythonPluginSystemPlugin through a top-level openassetioPlugin
variable.
Paths are searched left-to-right, but only the first instance of any given plugin identifier will be used, and subsequent registrations ignored. This means entries to the left of the paths list take precedence over ones to the right.
paths | str A list of paths to search, delimited by os.pathsep . |
def scan_entry_points | ( | self, | |
entryPointName | |||
) |
Searches packages for entry points that define a PythonPluginSystemPlugin through a top-level openassetioPlugin
variable.
importlib
, only the first plugin with any given identifier will be registered.entryPointName | str The entry point name to search for (see: importlib.metadata.entry_points group). |
Copyright 2013-2023 The Foundry Visionmongers Ltd. OpenAssetIO is released under the Apache 2.0 License