skip to navigation
skip to content

Not Logged In

annex 0.3.1

A Simple Plugin System for Python

Summary

Annex provides assistance with developing plugin-based tools.

With Annex you can load and reload plugins from various python modules without the requirement that they exist on the PYTHONPATH.

Example Usage

In your project you would define a base class from which all plugins for project would subclass.

base_plugin.py

class BaseTestPlugin(object):
    def run(self, *args, **kwargs):
        raise NotImplementedError()

example_plugin.py

from base_plugin import BaseTestPlugin

class PrinterPlugin(BaseTestPlugin):
    def run(self, *args, **kwargs):
        print args, kwargs

foo.py

from base_plugin import BaseTestPlugin
from annex import Annex

plugins = Annex(BaseTestPlugin, ["/path/to/plugins"])

for plugin in plugins:
    plugin.run("foo", bar="baz")
 
File Type Py Version Uploaded on Size
annex-0.3.1.tar.gz (md5) Source 2014-07-16 3KB
  • Downloads (All Versions):
  • 6 downloads in the last day
  • 51 downloads in the last week
  • 225 downloads in the last month