sierra.core.plugin_manager
Simple plugin managers to make SIERRA OPEN/CLOSED.
module_exists()
: Check if a module exists before trying to import it.module_load()
: Import the specified module.bc_load()
: Load the specified Batch Criteria.module_load_tiered()
: Attempt to load the specified python module with tiered precedence.
- sierra.core.plugin_manager.module_exists(name: str) bool [source]
Check if a module exists before trying to import it.
- 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:
Check if the requested module is a project. If it is, return it.
Check if the requested module is a part of a project (i.e.,
<project>.<path>
exists). If it does, return it. This requires thatSIERRA_PLUGIN_PATH
to be set properly.Check if the requested module is provided by the platform plugin (i.e.,
sierra.platform.<platform>.<path>
exists). If it does, return it.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.
BasePluginManager
: Base class for common functionality.FilePluginManager
: Plugins are.py
files within a root plugin directory.DirectoryPluginManager
: Plugins are directories found in a root plugin directory.ProjectPluginManager
: Plugins are directories found in a root plugin directory.CompositePluginManager
: Base class for common functionality.
- class sierra.core.plugin_manager.BasePluginManager[source]
Base class for common functionality.
Inheritance
- __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 '
- __module__ = 'sierra.core.plugin_manager'
- __weakref__
list of weak references to the object (if defined)
- class sierra.core.plugin_manager.FilePluginManager[source]
Plugins are
.py
files within a root plugin directory.Intended for use with models.
Inheritance
- __doc__ = 'Plugins are ``.py`` files within a root plugin directory.\n\n Intended for use with :term:`models <Model>`.\n\n '
- __module__ = 'sierra.core.plugin_manager'
- 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
- __doc__ = 'Plugins are `directories` found in a root plugin directory.\n\n Intended for use with :term:`Pipeline plugins <plugin>`.\n\n '
- __module__ = 'sierra.core.plugin_manager'
- 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
- __doc__ = 'Plugins are `directories` found in a root plugin directory.\n\n Intended for use with :term:`Project plugins <plugin>`.\n\n '
- __module__ = 'sierra.core.plugin_manager'