Skip to main content

A Simple Plugin System for Python

Project description

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")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

annex-0.5.0.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file annex-0.5.0.tar.gz.

File metadata

  • Download URL: annex-0.5.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for annex-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2b89c89ecef0911dd1bc52ce582c2b7b26b8621f4db3cc58df39e652b9636e8b
MD5 10091a97f1176d5bb056a4c036a62081
BLAKE2b-256 c4036c73f4e91312abbec5efab91ad91483fb23613d1c50d436cc2c320f7bf42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page