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.0.0.tar.gz
(8.9 kB
view details)
Built Distribution
File details
Details for the file pluginmgr-1.0.0.tar.gz
.
File metadata
- Download URL: pluginmgr-1.0.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa50a48c11b7d36874a1a9877da09e885d2170c6dd1d83d4933ff812c4015d01 |
|
MD5 | 9a6f409138dac9e7377fd5b0ccb85c47 |
|
BLAKE2b-256 | 02c8f2ae4ff692e1e2f5fae946b3e8a8f9c8c4a5b3d50292e4df0e7e3fec7355 |
File details
Details for the file pluginmgr-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pluginmgr-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 189592d7a36d560cbb5aad7d9e806064666c4262b171bcd7a9a3ef79b54434ea |
|
MD5 | dc3940454c5e3818b983a2e58c90ba6b |
|
BLAKE2b-256 | 45f4eaa2adb52770b11b059ab738882abff833aba10871078acf3428eb65c92e |