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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pluginmgr-1.2.0.tar.gz.
File metadata
- Download URL: pluginmgr-1.2.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42b48f1ea6f961b621ea20b37a350d1ae3811fc294572a3e8ea896cf2f370a66
|
|
| MD5 |
4a8892bf3d2d109e922bed79d6bc69e8
|
|
| BLAKE2b-256 |
b7e8d9600b4a18441c3779a3726451c8d9a5a4791036a5b0b016c34a836c007c
|
File details
Details for the file pluginmgr-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pluginmgr-1.2.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fef434ee20c441a1c6e44d248a7df8dccd35d5546b2aecd3f12300441ae8fcd
|
|
| MD5 |
2693586dc3ab0c5b6b2ee17c1f2de557
|
|
| BLAKE2b-256 |
7fae30821d5f90abf21163be85636151213775d8b610a773921902496373aadd
|