vipr.plugins.discovery package¶
Submodules¶
vipr.plugins.discovery.controllers module¶
Discovery Controller
Provides commands for interacting with the Discovery system.
- class vipr.plugins.discovery.controllers.DiscoveryController(*args: Any, **kw: Any)¶
Bases:
ArgparseControllerController for Discovery functions.
- class Meta¶
Bases:
object- description = 'Manages the VIPR Component Discovery system'¶
- help = 'Tools for managing VIPR components'¶
- label = 'discovery'¶
- stacked_on = 'base'¶
- stacked_type = 'nested'¶
- components()¶
Lists all available components. No input required for this GET endpoint.
- data_loaders()¶
Lists all available data loaders.
- filter_types()¶
Lists all available filter types.
- filters()¶
Lists all available filters.
- hook_types()¶
Lists all available hook types.
- hooks()¶
Lists all available hooks.
- model_loaders()¶
Lists all available model loaders.
- plugins()¶
Lists all available plugins by type.
- postprocessors()¶
Lists all available postprocessing handlers.
- predictors()¶
Lists all available prediction handlers.
vipr.plugins.discovery.decorators module¶
Decorator-based discovery for components.
This module provides decorators for registering hooks, filters, data loaders, and other components with the central discovery system.
- vipr.plugins.discovery.decorators.clear_discovery()¶
Clear all registered components (mainly for testing).
- vipr.plugins.discovery.decorators.discover_component(registry: dict[str, list[dict[str, Any]]], component_type: str, registry_name: str, weight: int = 0, enabled_in_config: bool = True, **parameters)¶
Generic decorator to register a component (hook or filter).
- Parameters:
registry – The registry to add to (hooks_registry or filters_registry)
component_type – The type of component (e.g. ‘POST_ARGUMENT_PARSING’)
registry_name – Name for logging (“hook” or “filter”)
weight – The execution priority (lower values run first)
enabled_in_config – Whether the component is enabled in generated configs by default
**parameters – Additional parameters for the component
- Returns:
The decorator function
- vipr.plugins.discovery.decorators.discover_data_loader(handler_name: str, parameters: type[BaseModel] | None = None)¶
Decorator to register a data loader.
- Parameters:
handler_name – The name/label of the data loader
parameters – Pydantic model class describing handler parameters
- Returns:
The decorated class
- vipr.plugins.discovery.decorators.discover_filter(filter_type: str, weight: int = 0, enabled_in_config: bool = True, **parameters)¶
Decorator to register a filter.
- Parameters:
filter_type – The type of filter (e.g. ‘INFERENCE_PREPROCESS_PRE_FILTER’)
weight – The execution priority of the filter (lower values run first)
enabled_in_config – Whether the filter is enabled in generated configs by default
**parameters – Additional parameters for the filter. parameters must be type[BaseModel] when provided.
- Returns:
The decorated function
- vipr.plugins.discovery.decorators.discover_hook(hook_type: str, weight: int = 0, enabled_in_config: bool = True, **parameters)¶
Decorator to discover a hook.
- Parameters:
hook_type – The type of hook (e.g. ‘POST_ARGUMENT_PARSING’)
weight – The execution priority of the hook (lower values run first)
enabled_in_config – Whether the hook is enabled in generated configs by default
**parameters – Additional parameters for the hook. parameters must be type[BaseModel] when provided.
- Returns:
The decorated function
- vipr.plugins.discovery.decorators.discover_model_loader(handler_name: str, parameters: type[BaseModel] | None = None)¶
Decorator to register a model loader.
- Parameters:
handler_name – The name/label of the model loader
parameters – Pydantic model class describing handler parameters
- Returns:
The decorated class
- vipr.plugins.discovery.decorators.discover_postprocessor(handler_name: str, parameters: type[BaseModel] | None = None)¶
Decorator to register a postprocessor.
- Parameters:
handler_name – The name/label of the postprocessor
parameters – Pydantic model class describing handler parameters
- Returns:
The decorated class
- vipr.plugins.discovery.decorators.discover_predictor(handler_name: str, parameters: type[BaseModel] | None = None)¶
Decorator to register a predictor.
- Parameters:
handler_name – The name/label of the predictor
parameters – Pydantic model class describing handler parameters
- Returns:
The decorated class
- vipr.plugins.discovery.decorators.get_discovered_components(registry: dict[str, list[dict[str, Any]]], component_type: str | None = None, plugin_name: str | list[str] | None = None) dict[str, list[dict[str, Any]]]¶
Get registered components, filtered by type and/or plugin(s).
- Parameters:
registry – The registry to search in
component_type – Optional component type to filter by
plugin_name – Optional plugin name(s) to filter by. Can be a string or list of strings.
- vipr.plugins.discovery.decorators.get_discovered_data_loaders(plugin_name: str | list[str] | None = None) list[dict[str, Any]]¶
Get registered data loaders, optionally filtered by plugin(s).
- Parameters:
plugin_name – Optional plugin name or list of plugin names to filter by
- Returns:
list of data loader definitions
- vipr.plugins.discovery.decorators.get_discovered_filters(filter_type: str | None = None, plugin_name: str | list[str] | None = None) dict[str, list[dict[str, Any]]]¶
Get registered filters, optionally filtered by type and/or plugin(s).
- Parameters:
filter_type – Optional filter type to filter by
plugin_name – Optional plugin name or list of plugin names to filter by
- vipr.plugins.discovery.decorators.get_discovered_hooks(hook_type: str | None = None, plugin_name: str | list[str] | None = None) dict[str, list[dict[str, Any]]]¶
Get registered hooks, optionally filtered by type and/or plugin(s).
- Parameters:
hook_type – Optional hook type to filter by
plugin_name – Optional plugin name or list of plugin names to filter by
- vipr.plugins.discovery.decorators.get_discovered_model_loaders(plugin_name: str | list[str] | None = None) list[dict[str, Any]]¶
Get registered model loaders, optionally filtered by plugin(s).
- Parameters:
plugin_name – Optional plugin name or list of plugin names to filter by
- Returns:
list of model loader definitions
- vipr.plugins.discovery.decorators.get_discovered_postprocessors(plugin_name: str | list[str] | None = None) list[dict[str, Any]]¶
Get registered postprocessors, optionally filtered by plugin(s).
- Parameters:
plugin_name – Optional plugin name or list of plugin names to filter by
- Returns:
list of postprocessor definitions
- vipr.plugins.discovery.decorators.get_discovered_predictors(plugin_name: str | list[str] | None = None) list[dict[str, Any]]¶
Get registered predictors, optionally filtered by plugin(s).
- Parameters:
plugin_name – Optional plugin name or list of plugin names to filter by
- Returns:
list of predictor definitions
vipr.plugins.discovery.models module¶
Response models for the Registry API endpoints.
This module provides Pydantic models representing the various response formats used by the registry controller endpoints.
- class vipr.plugins.discovery.models.CallbackEntry(*, enabled: bool, weight: int, method: str, class_: str, parameters: Dict[str, Any] | None = None, parameters_schema: Dict[str, Any] | None = None)¶
Bases:
BaseModelBase model for hook and filter entries.
- classmethod map_enabled_field(data: Any) Any¶
Accept both ‘enabled’ and ‘enabled_in_config’ fields.
This validator maps the internal registry field ‘enabled_in_config’ to the API/YAML field ‘enabled’ for backwards compatibility.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vipr.plugins.discovery.models.ComponentsResponse(*, model_loaders: List[HandlerEntry], data_loaders: List[HandlerEntry], hooks: Dict[str, List[CallbackEntry]], filters: Dict[str, List[CallbackEntry]], predictors: List[HandlerEntry])¶
Bases:
BaseModelResponse model for the components endpoint.
- data_loaders: List[HandlerEntry]¶
- filters: Dict[str, List[CallbackEntry]]¶
- hooks: Dict[str, List[CallbackEntry]]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_loaders: List[HandlerEntry]¶
- predictors: List[HandlerEntry]¶
- class vipr.plugins.discovery.models.ComponentsSummary(*, model_loaders: int, data_loaders: int, hooks: int, filters: int, predictors: int)¶
Bases:
BaseModelSummary of component counts by type.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vipr.plugins.discovery.models.HandlerEntry(*, handler: str, class_: str, parameters: ~typing.Dict[str, ~typing.Any] = <factory>, parameters_schema: ~typing.Dict[str, ~typing.Any] | None = None)¶
Bases:
BaseModelBase model for model loaders, data loaders, and predictors.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vipr.plugins.discovery.models.PluginSummaryResponse(*, components_summary: ComponentsSummary)¶
Bases:
BaseModelResponse model for plugin summary endpoint.
- components_summary: ComponentsSummary¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Module contents¶
VIPR Registry Plugin
This plugin provides a registry system for VIPR components: - Model Loaders - Data Loaders - Hooks - Filters
It enables listing available components and generating configuration files.
- vipr.plugins.discovery.load(app)¶
Loads the Registry plugin