tukuy.plugins
Submodules
tukuy.plugins.base module
Base classes and utilities for the plugin system.
- class tukuy.plugins.base.PluginRegistry
Bases:
objectRegistry for managing transformer plugins.
The registry maintains the collection of loaded plugins and their transformers, handling registration, unregistration, and access to transformer factories.
- __init__()
Initialize an empty plugin registry.
- get_plugin(name: str) TransformerPlugin | None
Get a plugin by name.
- Parameters:
name – Name of the plugin
- Returns:
The plugin instance, or None if not found
- get_transformer(name: str) callable | None
Get a transformer factory by name.
- Parameters:
name – Name of the transformer
- Returns:
The transformer factory function, or None if not found
- property plugins: Dict[str, TransformerPlugin]
Get all registered plugins.
- register(plugin: TransformerPlugin) None
Register a plugin with the registry.
- Parameters:
plugin – The plugin to register
- Raises:
ValueError – If a plugin with the same name is already registered
- property transformers: Dict[str, callable]
Get all registered transformers.
- unregister(name: str) None
Unregister a plugin from the registry.
- Parameters:
name – Name of the plugin to unregister
- class tukuy.plugins.base.TransformerPlugin(name: str)
Bases:
ABCBase class for transformer plugins.
A plugin is a collection of related transformers that can be registered with the TukuyTransformer. Plugins provide a way to organize transformers into logical groups and manage their lifecycle.
- __init__(name: str)
Initialize the plugin.
- Parameters:
name – Unique identifier for this plugin
- cleanup() None
Called when the plugin is unloaded.
Override this method to perform any cleanup required by the plugin.
- initialize() None
Called when the plugin is loaded.
Override this method to perform any setup required by the plugin.
- abstract property transformers: Dict[str, callable]
Get the transformers provided by this plugin.
- Returns:
A dictionary mapping transformer names to factory functions