Skip to content

Repository files navigation

pluginmgr

PyPIPyPITestsCodecovLanguage grade: Python

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

importpluginmgr# this is the namespace string that import usesnamespace='pluginmgr_test.plugins'# directories to look in, string or list of stringssearchpath='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 Falsecreate_loader=Falseplugin=pluginmgr.PluginManager(namespace, searchpath, create_loader)

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

frompluginmgr_testimportplugin# register a plugin named mod0@plugin.register('mod0')classMod0(pluginmgr.PluginBase):
pass

See the dict containing all registered plugins

frompluginmgr_testimportplugin# dict of all registered pluginsprint(plugin.registry)

About

lightweight python plugin system supporting config inheritance

Resources

Stars

5 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages