manager¶
Utility function to retrieve the global hook_manager singleton.
- drain_swamp.monkey.hooks.manager._PLUGIN_HOOKS: str = "drain_swamp.hooks"¶
Entrypoint to load hooks from for built-in or installed plugins
- drain_swamp.monkey.hooks.manager.logger: logging.Logger¶
Module level logger
See also
kedro manager [SOURCE] [LICENSE:Apache 2.0]
- drain_swamp.monkey.hooks.manager.after(outcome, hook_name, hook_impls, kwargs)¶
Runs after plugin hook execution. Gatherings non-None outcomes into a list
- Parameters:
outcome¶ (pluggy.Result[Any]) – List of non-None plugin hook results
hook_impls¶ (collections.abc.Sequence[pluggy.HookImpl]) – Sequence of HookImpl instances. Can see which hooks are being executed
kwargs¶ (collections.abc.Mapping[str, Any]) – Keyword args passed into hook impl instances
- drain_swamp.monkey.hooks.manager.before(hook_name, hook_impls, kwargs)¶
Hook call tracing. Before a hook is called
- Parameters:
hook_impls¶ (collections.abc.Sequence[pluggy.HookImpl]) – Sequence of HookImpl instances. Can see which hooks are being executed
kwargs¶ (collections.abc.Mapping[str, Any]) – Keyword args passed into hook impl instances
Usage
from pluggy import PluginManager namespace = "ds" pm = PluginManager(namespace) # add hookspecs # register hooks undo = pm.add_hookcall_monitoring(before, after)
See also
- drain_swamp.monkey.hooks.manager.get_plugin_manager(mod_pkg_plugins, namespace='ds', specs_dotted_path='drain_swamp.monkey.hooks.specs', entrypoint_plugins='ds.hooks')¶
Get plugin manager
set specs
load builtin hooks
load entrypoint hooks
- Parameters:
mod_pkg_plugins¶ (types.ModuleType) – plugins subpackage module
namespace¶ (str | None) – Default HOOK_NAMESPACE. hook namespace, so as to support multiple
specs_dotted_path¶ (str | None) – Default DOTTED_PATH_SPECS. dotted path to specs module
entrypoint_plugins¶ (str | None) – Default _PLUGIN_HOOKS. setuptools entrypoint section to specify additional
python -m build
time plugins
- Returns:
Plugin manager instance
- Return type:
- Raises:
:py:exc:TypeError – Expected param mod_pkg_plugins to be a types.ModuleType Package folder with modules containg hook implementation functions