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_flow(name: str) → None[source]
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.
activate_plugin(name: str) → None[source]

Activate a plugin with its dependencies.

blacklist_plugin(name: str) → str[source]
deactivate_all_plugins() → None[source]
deactivate_flow(name: str) → None[source]
deactivate_plugin(name: str) → None[source]
get_all_active_plugin_names() → List[str][source]
get_all_active_plugins() → List[errbot.botplugin.BotPlugin][source]

This returns the list of plugins in the callback ordered defined from the config.

get_all_plugin_names() → List[str][source]
get_blacklisted_plugin() → List[T][source]
get_plugin_by_path(path: str) → Optional[str][source]
get_plugin_configuration(name: str) → Optional[Any][source]
get_plugin_obj_by_name(name: str) → errbot.botplugin.BotPlugin[source]
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.
get_plugins_by_path(path: str)[source]
is_plugin_blacklisted(name: str) → bool[source]
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.

set_plugin_configuration(name: str, obj: Any)[source]
shutdown() → None[source]
unblacklist_plugin(name: str) → str[source]
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.

exception errbot.plugin_manager.IncompatiblePluginException[source]

Bases: errbot.plugin_manager.PluginActivationException

exception errbot.plugin_manager.PluginActivationException[source]

Bases: Exception

exception errbot.plugin_manager.PluginConfigurationException[source]

Bases: errbot.plugin_manager.PluginActivationException

class errbot.plugin_manager.TopologicalSorter(graph=None)[source]

Bases: graphlib.graphlib.TopologicalSorter

find_cycle()[source]

Wraps private method as public one.

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

errbot.plugin_manager.install_packages(req_path: pathlib.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: errbot.botplugin.BotPlugin, plugin_info: errbot.plugin_info.PluginInfo) → None[source]