Skip to content

magmax/python-pluginloader

Repository files navigation

VERSION DOWNLOADS TESTS COVERAGE
Latest PyPI version Number of PyPI downloads Travis results Coveralls results_

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

  • It will instantiate each plugin found.
  • 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.

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')
instance = plugins['Foo']()

Simple and easy.

License

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

Licensed under the MIT license.

About

Library to manage python plugins/extensions

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages