No project description provided
Project description
Gufo Labs Loader
Generic Python class loader for robust plugin infrastructure.
Documentation: https://docs.gufolabs.com/gufo_loader/
Source Code: https://github.com/gufolabs/gufo_loader/
Loader delivers plugins from one or many plugin packages.
Loader
Loader is the dict-like singleton providing the following services:
- plugin initialization and fetching.
- plugins enumeration.
Plugins are not dependent on the loader and do not need any registration process. The loaders are lazy by nature, meaning the plugin will be imported and initialized just in time when the user code requests the plugin.
Plugins
Plugins are named entities dedicated to the given task. Each plugin is defined in its python module. Depending on the loader settings plugins can be:
- Instances: Singleton instances having the class as the ancestor.
- Subclasses: Classes having the common ancestor.
- Protocols: Classes following the set of methods.
Plugin Packages
Plugin packages are plain Python packages: the directory containing
python files with plugins and the empty __init__.py
file.
Plugin name must match the module name. For example, module
my_plugin.py
will define the plugin my_plugin
.
Examples:
Plugins as the subclasses:
loader = Loader[Type[BasePlugin]](base="myproject.plugins")
Plugins as the singletones:
loader = Loader[BasePlugin](base="myproject.plugins")
Plugins as the protocols:
loader = Loader[MyProtocol](base="myproject.plugins")
Project details
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
Hashes for gufo_loader-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afa49dd87ed94e31d2f531f4ac59e378da9db062e822e6a15cbd27b3c70298a4 |
|
MD5 | d67fc8d1c36913f735a063df37e4be0d |
|
BLAKE2b-256 | f998a977c2343babeafc8603e6efe269c9fa6be0203abf04deb456a277f3d24b |