sierra.core.plugin_manager

Simple plugin managers to make SIERRA OPEN/CLOSED.

sierra.core.plugin_manager.module_exists(name: str) bool[source]

Check if a module exists before trying to import it.

sierra.core.plugin_manager.module_load(name: str) module[source]

Import the specified module.

sierra.core.plugin_manager.bc_load(cmdopts: Dict[str, Any], category: str)[source]

Load the specified Batch Criteria.

sierra.core.plugin_manager.module_load_tiered(path: str, project: Optional[str] = None, platform: Optional[str] = None) module[source]

Attempt to load the specified python module with tiered precedence.

Generally, the precedence is project -> project submodule -> platform module -> SIERRA core module, to allow users to override SIERRA core functionality with ease. Specifically:

  1. Check if the requested module is a project. If it is, return it.

  2. Check if the requested module is a part of a project (i.e., <project>.<path> exists). If it does, return it. This requires that SIERRA_PLUGIN_PATH to be set properly.

  3. Check if the requested module is provided by the platform plugin (i.e., sierra.platform.<platform>.<path> exists). If it does, return it.

  4. Check if the requested module is part of the SIERRA core (i.e., sierra.core.<path> exists). If it does, return it.

If no match was found using any of these, throw an error.

class sierra.core.plugin_manager.BasePluginManager[source]

Base class for common functionality.

Inheritance

Inheritance diagram of BasePluginManager
__dict__ = mappingproxy({'__module__': 'sierra.core.plugin_manager', '__doc__': '\n    Base class for common functionality.\n    ', '__init__': <function BasePluginManager.__init__>, 'available_plugins': <function BasePluginManager.available_plugins>, 'load_plugin': <function BasePluginManager.load_plugin>, 'get_plugin': <function BasePluginManager.get_plugin>, 'get_plugin_module': <function BasePluginManager.get_plugin_module>, 'has_plugin': <function BasePluginManager.has_plugin>, '__dict__': <attribute '__dict__' of 'BasePluginManager' objects>, '__weakref__': <attribute '__weakref__' of 'BasePluginManager' objects>, '__annotations__': {'loaded': 'tp.Dict[str, tp.Dict]'}})
__doc__ = '\n    Base class for common functionality.\n    '
__init__() None[source]
__module__ = 'sierra.core.plugin_manager'
__weakref__

list of weak references to the object (if defined)

available_plugins()[source]
get_plugin(name: str) dict[source]
get_plugin_module(name: str) module[source]
has_plugin(name: str) bool[source]
load_plugin(name: str) None[source]

Load a plugin module.

class sierra.core.plugin_manager.FilePluginManager[source]

Plugins are .py files within a root plugin directory.

Intended for use with models.

Inheritance

Inheritance diagram of FilePluginManager
__doc__ = 'Plugins are ``.py`` files within a root plugin directory.\n\n    Intended for use with :term:`models <Model>`.\n\n    '
__init__() None[source]
__module__ = 'sierra.core.plugin_manager'
available_plugins() Dict[str, Dict][source]

Get the available plugins in the configured plugin root.

initialize(project: str, search_root: Path) None[source]
loaded: Dict[str, Dict]
class sierra.core.plugin_manager.DirectoryPluginManager(search_root: Path)[source]

Plugins are directories found in a root plugin directory.

Intended for use with Pipeline plugins.

Inheritance

Inheritance diagram of DirectoryPluginManager
__doc__ = 'Plugins are `directories` found in a root plugin directory.\n\n    Intended for use with :term:`Pipeline plugins <plugin>`.\n\n    '
__init__(search_root: Path) None[source]
__module__ = 'sierra.core.plugin_manager'
available_plugins()[source]

Find all pipeline plugins in all directories within the search root.

initialize(project: str) None[source]
loaded: Dict[str, Dict]
class sierra.core.plugin_manager.ProjectPluginManager(search_root: Path, project: str)[source]

Plugins are directories found in a root plugin directory.

Intended for use with Project plugins.

Inheritance

Inheritance diagram of ProjectPluginManager
__doc__ = 'Plugins are `directories` found in a root plugin directory.\n\n    Intended for use with :term:`Project plugins <plugin>`.\n\n    '
__init__(search_root: Path, project: str) None[source]
__module__ = 'sierra.core.plugin_manager'
available_plugins()[source]

Find all pipeline plugins in all directories within the search root.

initialize(project: str) None[source]
loaded: Dict[str, Dict]
class sierra.core.plugin_manager.CompositePluginManager[source]

Inheritance

Inheritance diagram of CompositePluginManager
__doc__ = None
__init__() None[source]
__module__ = 'sierra.core.plugin_manager'
available_plugins()[source]
initialize(project: str, search_path: List[Path]) None[source]
loaded: Dict[str, Dict]