plpipes.plugin#
Plugin
#
A base class for plugins to be registered in the Registry.
Source code in src\plpipes\plugin.py
Registry
#
A class to manage a registry of plugins.
Attributes:
| Name | Type | Description |
|---|---|---|
_name |
The name of the registry. |
|
_path |
The import path for the plugins. |
|
_registry |
A dictionary holding registered plugins. |
Source code in src\plpipes\plugin.py
__init__(name, path)
#
Initializes the Registry with a name and path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
The name of the registry. |
required | |
path
|
The import path where plugins are located. |
required |
lookup(key, subkeys=None)
#
Looks up a registered object by its key and optional subkeys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
The main key for the lookup. |
required | |
subkeys
|
Optional list of subkeys to further refine the lookup. |
None
|
Returns:
| Type | Description |
|---|---|
|
The object associated with the given key and subkeys. |
Raises:
| Type | Description |
|---|---|
ModuleNotFoundError
|
If the module corresponding to the key cannot be found. |
Source code in src\plpipes\plugin.py
plugin(klass)
#
A decorator that initializes a plugin and adds it to the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
klass
|
The class to be registered as a plugin. |
required |
Returns:
| Type | Description |
|---|---|
|
The decorated class. |