Loader
Functionality for finding and loading Pulse Build Actions from a library of actions.
- class BuildActionLoader(use_registry=True)
Bases:
objectHandles finding and loading Build Action modules and returning them as BuildActionSpec objects. They can then be registered with the build action registry for use.
- load_actions_from_package(package: ModuleType) List[BuildActionSpec]
Recursively find all pulse actions in a python package. Searches BuildAction subclasses recursively in all submodules. Automatically register each spec if self.use_registry is True.
- Parameters:
package – A python package containing BuildActions
- register_actions(action_specs: List[BuildActionSpec])
Register action specs with the shared registry.
- class BuildActionPackageRegistry
Bases:
objectA registry of packages where actions should be loaded. Also keeps track of whether all packages have been loaded, and can reload packages when necessary.
- add_package(package, reload=False)
Add an actions package to the registry. Does not load the actions, intended to be called during startup.
- classmethod get()
Return the main BuildActionPackageRegistry
- load_actions()
Load all available pulse actions.
- reload_actions()
Clear all loaded actions from the registry and load actions again.
- import_all_submodules(pkg_name: str)
Import all python modules within a package recursively. Used to make sure all build actions are loaded within an actions package so that they can be found by the loader.
Designed to be called in the root __init__.py of every actions package:
> from pulse import loader > loader.import_all_submodules(__name__)
- Parameters:
pkg_name – The name of python package where everything will be imported
- load_actions()
Load all available pulse actions.
- reload_actions()
Clear all loaded actions from the registry and load actions again.