errbot.plugin_manager module¶
Logic related to plugin loading and lifecycle
-
class
errbot.plugin_manager.
BotPluginManager
(storage_plugin: errbot.storage.base.StoragePluginBase, extra_plugin_dir: Optional[str], autoinstall_deps: bool, core_plugins: Tuple[str, ...], plugin_instance_callback: Callable[[str, Type[errbot.botplugin.BotPlugin]], errbot.botplugin.BotPlugin], plugins_callback_order: Tuple[Optional[str], ...])[source]¶ Bases:
errbot.storage.StoreMixin
-
__init__
(storage_plugin: errbot.storage.base.StoragePluginBase, extra_plugin_dir: Optional[str], autoinstall_deps: bool, core_plugins: Tuple[str, ...], plugin_instance_callback: Callable[[str, Type[errbot.botplugin.BotPlugin]], errbot.botplugin.BotPlugin], plugins_callback_order: Tuple[Optional[str], ...])[source]¶ Creates a Plugin manager :type autoinstall_deps:
bool
:type storage_plugin:StoragePluginBase
:param storage_plugin: the plugin used to store to config for this manager :param extra_plugin_dir: an extra directory to search for plugins :param autoinstall_deps: if True, will install also the plugin deps from requirements.txt :param core_plugins: the list of core plugin that will be started :param plugin_instance_callback: the callback to instantiate a plugin (to inject the dependency on the bot) :param plugins_callback_order: the order on which the plugins will be callbacked
-
activate_non_started_plugins
() → None[source]¶ Activates all plugins that are not activated, respecting its dependencies.
Returns: Empty string if no problem occurred or a string explaining what went wrong.
-
get_all_active_plugins
() → List[errbot.botplugin.BotPlugin][source]¶ This returns the list of plugins in the callback ordered defined from the config.
-
get_plugins_activation_order
() → List[str][source]¶ Calculate plugin activation order, based on their dependencies.
Returns: list of plugin names, in the best order to start them.
-
reload_plugin_by_name
(name: str) → None[source]¶ Completely reload the given plugin, including reloading of the module’s code :throws PluginActivationException: needs to be taken care of by the callers.
-
remove_plugin
(plugin: errbot.botplugin.BotPlugin) → None[source]¶ Deactivate and remove a plugin completely. :type plugin:
BotPlugin
:param plugin: the plugin to remove :return:
-
remove_plugins_from_path
(root: str) → None[source]¶ Remove all the plugins that are in the filetree pointed by root.
-
update_plugin_places
(path_list: str) → Dict[pathlib.Path, str][source]¶ This updates where this manager is trying to find plugins and try to load newly found ones. :type path_list:
str
:param path_list: the path list where to search for plugins. :return: the feedback for any specific path in case of error.
-
-
class
errbot.plugin_manager.
TopologicalSorter
(graph=None)[source]¶ Bases:
graphlib.graphlib.TopologicalSorter
-
errbot.plugin_manager.
check_errbot_version
(plugin_info: errbot.plugin_info.PluginInfo)[source]¶ Checks if a plugin version between min_version and max_version is ok for this errbot. Raises IncompatiblePluginException if not.
-
errbot.plugin_manager.
check_python_plug_section
(plugin_info: errbot.plugin_info.PluginInfo) → bool[source]¶ Checks if we have the correct version to run this plugin. Returns true if the plugin is loadable