ninjecto.plugins.loader
¶Module to load plugins.
FunctionLoader
:
Function loader utility class.ninjecto.plugins.loader.
FunctionLoader
(package, component, api_version='1.0')¶Function loader utility class.
This class allows to load functions using Python entry points.
Inheritance
load_functions
(cache=True)¶Load all available functions.
This function load all available functions by discovering installed functions registered in the entry point. This can be costly or error prone if the package that declared the entrypoint misbehave. Because of this a cache is stored after the first call.
True
return the cached result. If False
force reload of all functions registered for the entry point.register
(key)¶Register a function locally.
This method is expected to be used as a decorator. It allows to register a function locally without having to create a full Python package to use entrypoints.
reset
()¶Reset locally registered functions.
unregister
(key)¶Unregister a previously registered function.