This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
VERSION DOWNLOADS TESTS COVERAGE

Goal and Philosophy

Pluginloader is a library to allow an easy way to load plugins. They can be managed by interfaces or just method validators.

Features

  • Each plugin can be instanciated several times.
  • Customizable filter to select if a class should be loaded as a plugin.
  • Sandboxed: plugins cannot access the main program or other plugins by default, because they are loaded in isolated environments.
  • Parameterizable context: Sometimes you need to pass some classes, functions or variables preloaded to the plugins. It is possible and easy.

Documentation

Installation

Two options: to install it in your system/project:

pip install pluginloader

Usage

You can load all plugins in a file, just doing:

loader = PluginLoader()
plugins = loader.load_file('plugins.py')

With those simple lines you will have in the variable plugins a dictionary with each class inside the plugins.py file as key and a factory as value.

Let’s see an example. Using the plugins.py file:

class Foo(object):
    pass

We can have an object of that class just with:

loader = PluginLoader()
plugins = loader.load_file('plugins.py')
instance1 = plugins['Foo']()
instance2 = plugins['Foo']()

Simple and easy.

API

This is a simple module with a simple API. It just contains one class, PluginLoader, with these public methods:

load_file(filename, onlyif=None, context=None)

Loads all plugins in a file.

Parameters:

  • filename: File name to be loaded.
  • onlyif: Value or function that will be called with each class found. It will skip the plugin if this function returns False.
  • context: Dict with the context where the method should be loaded in. It usually will map a class, function or variable name to the class, function or value in the main program, so it can be used within the plugin.

load_directory(path, onlyif=None, recursive=False))

Loads all plugins in a directory.

Parameters:

  • path: Path where plugins are in.
  • onlyif: Value or function that will be called with each class found. It will skip the plugin if this function returns False.
  • recursive: Boolean value to allow recursive read of directories.
  • context: Dict with the context where the method should be loaded in.

Links will always be ignored.

License

Copyright (c) 2014 Miguel Ángel García (@magmax9).

Licensed under the MIT license.

Release History

Release History

0.1.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pluginloader-0.1.3.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source Jun 4, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting