errbot.plugin_manager module¶
Logic related to plugin loading and lifecycle
- class errbot.plugin_manager.BotPluginManager(storage_plugin: StoragePluginBase, extra_plugin_dir: str | None, autoinstall_deps: bool, core_plugins: Tuple[str, ...], plugin_instance_callback: Callable[[str, Type[BotPlugin]], BotPlugin], plugins_callback_order: Tuple[str | None, ...])[source]¶
Bases:
StoreMixin
- __init__(storage_plugin: StoragePluginBase, extra_plugin_dir: str | None, autoinstall_deps: bool, core_plugins: Tuple[str, ...], plugin_instance_callback: Callable[[str, Type[BotPlugin]], BotPlugin], plugins_callback_order: Tuple[str | None, ...])[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[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: BotPlugin) None [source]¶
Deactivate and remove a plugin completely. :type plugin:
BotPlugin
:param plugin: the plugin to remove :return:
- exception errbot.plugin_manager.IncompatiblePluginException[source]¶
Bases:
PluginActivationException
- exception errbot.plugin_manager.PluginConfigurationException[source]¶
Bases:
PluginActivationException
- errbot.plugin_manager.check_errbot_version(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: PluginInfo) bool [source]¶
Checks if we have the correct version to run this plugin. Returns true if the plugin is loadable
- errbot.plugin_manager.install_packages(req_path: Path)[source]¶
Installs all the packages from the given requirements.txt
Return an exc_info if it fails otherwise None.
- errbot.plugin_manager.populate_doc(plugin_object: BotPlugin, plugin_info: PluginInfo) None [source]¶