The plugin module provides several helper functions that wrap twisted.plugin. plugin makes loading plugins simpler.
Given a list of names, expand wildcards and discard disabled names.
Used to implement * and - options in plugin lists.
Parameters: | |
---|---|
Returns: | a list of filtered plugin names |
Lazily find objects in a package which implement a given interface.
The objects must also implement twisted.plugin.IPlugin.
If the optional dictionary of parameters is provided, it will be passed into each plugin module as the “bravo.parameters” module. An example access from inside the plugin:
>>> from bravo.parameters import foo, bar
Since the parameters are available as a real module, the parameters may be imported and used like any other module:
>>> from bravo import parameters as params
This is a rewrite of Twisted’s twisted.plugin.getPlugins which uses Exocet instead of Twisted to find the plugins.
Parameters: |
---|
Look up a list of plugins by name.
Plugins are returned in the same order as their names.
Parameters: | |
---|---|
Returns: | a list of plugins |
Raises PluginException: | |
no plugins could be found for the given interface |
Look up all plugins for a certain interface.
If the plugin cache is enabled, this function will not attempt to reload plugins from disk or discover new plugins.
Parameters: |
|
---|---|
Returns: | a dict of plugins, keyed by name |
Raises PluginException: | |
no plugins could be found for the given interface |
Look up a list of plugins, sorted by interdependencies.
Parameters: | parameters (dict) – parameters to pass into the plugins |
---|
Make a sorted list of plugins by dependency.
If the list cannot be arranged into a DAG, an error will be raised. This usually means that a cyclic dependency was found.
Raises PluginException: | |
---|---|
cyclic dependency detected |
Create a faked module which has the given parameters in it.
This should work everywhere. If it doesn’t, let me know.
Plugin interface verification.
This function will call verifyObject() and validateInvariants() on the plugins passed to it.
The primary purpose of this wrapper is to do logging, but it also permits code to be slightly cleaner, easier to test, and callable from other modules.