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

Pluggage

A Utility library for using plugins with python There are two ways to use this library to dynamically load objects, a lightweight load-on-demand via a dictionary interface and a heavier factory pattern using a base class to register objects with a factory.

Lightweight Plugins

The lightweight plugin system uses a dictionary API to load dot-delimited names and either return the object or optionally call it.

from pluggage.plugins import Plugins
loader = Plugins()

# load references to objects
func_ref = loader['some_module.some_submodule.some_function']
cls_ref = loader['some_module.some_submodule.SomeClass']

# call the objects and get the results
func_result = loader('some_module.some_submodule.some_function', *func_args, **func_kwargs)
someclass_instance = loader('some_module.some_submodule.SomeClass', *ctor_args, **ctor_kwargs)

Heavyweight Plugins

The Heavyweight Plugins are implemented via a metaclass registry that allows classes to be registered as plugins on import, and then accessed via a named factory. Classes inheriting from the base plugin class specify which factory they will be registered with and by default will register under that factory with their class name, or that can also be overridden by inheritance. The plugins can be accessed using a get_factory call provided in the pluggage.registry module.

factory = get_factory('my_factory')
some_class_instance = factory('SomeClass', *ctor_args, **ctor_kwargs)

To register a class with a factory, inherit from the PluggagePlugin class and set the PLUGGAGE_FACTORY_NAME class attribute:

from pluggage.factory_plugin import PluggagePlugin

class SomeClass(PluggagePlugin):
    """
    sample plugin
    """
    PLUGGAGE_FACTORY_NAME = 'my_factory'
    def __init__(self, value):
        self.value = value
    def __call__(self):
        print(value)

factory = get_factory('my_factory')
some_class_instance = factory('SomeClass', 'abc')
some_class_instance()  # prints 'abc'
Release History

Release History

0.0.4

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.0.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.0.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

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
pluggage-0.0.4.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Oct 20, 2015

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