lightweight python plugin system supporting config inheritance
Project description
pluginmgr
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pluginmgr-1.1.0.tar.gz
(9.1 kB
view details)
Built Distribution
File details
Details for the file pluginmgr-1.1.0.tar.gz
.
File metadata
- Download URL: pluginmgr-1.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 473eae4056a3d8f33036287d19ea09ca3f82ba50330f8d187cdd279839e8e2d7 |
|
MD5 | bf5838b835bc3553663d2c836480d770 |
|
BLAKE2b-256 | 29747b26440ad74b9fd5e816c1bf7546c0522b07a4698f35da11a5735d61f2fa |
File details
Details for the file pluginmgr-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: pluginmgr-1.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1737de45f3055a3a16b544f1177dd4e2c018c2fcac913e1d2603769513d60ece |
|
MD5 | 520862a93ad774b4f2e75b2118415a81 |
|
BLAKE2b-256 | 8f50289230fe8046d1e5f8ffe730048e1bf11bbdc31b66377f3f3b1bd490b71d |