Creating and Organizing plugins

We've designed will to be able to scale from small, personal installs to big, corporate robots. Here's the best practices on creating and organizing your plugins.

Where do plugins live?

Since plugins are just python files, they can live anywhere on the PYTHONPATH. Will will look for plugins anywhere on the system PYTHONPATH, and automatically adds will/plugins and your_will/plugins to the path.

How do I specify which plugins to load?

The list of plugins to load lives in, as well as a blacklist of plugins that, even if they're on the path, should be ignored.

When given a module, will imports it, then recursively loads all plugins found within it.


Built-in will plugins, e.g.:

Plugins in your will, e.g.:

Plugins anywhere else on your PYTHONPATH, e.g.:

Here's the corresponding section of, by default:

    # Built-ins

    # All plugins in your project.

# Don't load any of the plugins in this list.  Same options as above.
    # "will.plugins.friendly.cookies",      # But who would deprive will of cookies??

What exactly is a plugin?

A plugin is just a python file with at least one class that subclasses WillPlugin, and at least one method that's decorated with one of will's listen decorators.

For example:

from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings

class PingPlugin(WillPlugin):

    def ping(self, message):
        self.reply(message, "PONG")

What's a module?

Modules are a way to group similar plugins.

Structurally, a will module is just a python module: a folder with an

Plugins folder with

That's it.

What about that awesome help text?

Glad you asked. The help text comes from a special variable, expected to be in

MODULE_DESCRIPTION = "Old-fashioned friendliness"

When help runs, plugins are grouped according to their MODULE_DESCRIPTION, which means you can have physically distinct modules that share the same help grouping.

Both core and our will plugins, grouped

Easy, right? Awesome. Now that you know where to put them, take a look at the built-in features on WillPlugin.