samuraix.pluginsys

This module is responsible for loading plugins.

exception samuraix.pluginsys.PluginError
raised by PluginLoader.require_key() if a required plugin key couldn’t be found.
class samuraix.pluginsys.PluginLoader(app)

A class loading all available plugins using setuptools entrypoints. First, all paths in the ‘core.plugin_paths’ configuration option are checked and all found setuptools distributions are added to the working set. These distributions usually are Python eggs - so, it is very easy to remove a plugin - you can just remove the egg from the plugin path. The plugin loader object is a dictionary subclass. You can access plugins by their keys, for example:

print self.app.plugins['desktops']

However, there is usually just one PluginLoader per samurai-x instance, and it’s loaded by the application. Internally.

add_entries()
iterate the plugin paths (the ‘core.plugin_paths’ option) and add all found distributions to the working set.
load_all()
load all plugins, warn if a plugin couldn’t be loaded.
require_key(key)
Call this to check if there is a plugin providing with the key key. If there is none, an PluginError is raised.
setup()
add the available distributions to the pkg_resources working set and load all plugins. That is called internally by the application.

samurai-x

Previous topic

samuraix.plugin

Next topic

samuraix.rect

This Page