Skip to content
lightweight python plugin system supporting config inheritance
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
facsimile
pluginmgr
tests
.gitignore
.landscape.yml
.pylintrc
.travis.yml
CHANGELOG.md
LICENSE
MANIFEST.in
README.md
setup.cfg
setup.py
tox.ini

README.md

pluginmgr

PyPI Travis CI Code Health Codecov Requires.io

lightweight python plugin system supporting config inheritance

To use

There is a full example at https://github.com/20c/pluginmgr/tree/master/tests/pluginmgr_test

Create the manager, for example in a module __init__.py file

import pluginmgr

# this is the namespace string that import uses
namespace = 'pluginmgr_test.plugins'

# directories to look in, string or list of strings
searchpath = 'path/to/search/in'

# determines if this should create a blank loader to import through. This
# should be enabled if there isn't a real module path for the namespace and
# disabled for sharing the namespace with static modules
# default is False
create_loader = False

plugin = pluginmgr.PluginManager(namespace, searchpath, create_loader)

Create and register a plugin, note the filename needs to be the same as registered name

from pluginmgr_test import plugin


# register a plugin named mod0
@plugin.register('mod0')
class Mod0(pluginmgr.PluginBase):
    pass

See the dict containing all registered plugins

from pluginmgr_test import plugin

# dict of all registered plugins
print(plugin.registry)
You can’t perform that action at this time.