Registry Module API Reference¶
This section documents the internals of the registry
module in Bijux CLI.
bijux_cli.contracts.registry ¶
Defines the contract for the plugin registry service.
This module specifies the RegistryProtocol
, a formal interface that any service responsible for managing the lifecycle of CLI plugins must implement. This includes registering, retrieving, and invoking hooks on plugins.
RegistryProtocol ¶
Bases: Protocol
Defines the contract for plugin management.
This interface specifies the methods for registering, deregistering, and interacting with plugins, as well as for invoking plugin hooks.
call_hook async
¶
Invokes a hook on all registered plugins that implement it.
Parameters:
-
hook
(str
) –The name of the hook to invoke.
-
*args
(Any
, default:()
) –Positional arguments to pass to the hook.
-
**kwargs
(Any
, default:{}
) –Keyword arguments to pass to the hook.
Returns:
-
Any
(Any
) –The result of the hook invocation. The exact return type depends on the specific hook's definition and implementation.
Source code in src/bijux_cli/contracts/registry.py
deregister ¶
Deregisters a plugin from the registry.
Parameters:
-
name
(str
) –The name or alias of the plugin to deregister.
Returns:
-
None
(None
) –
get ¶
Retrieves a plugin by its name or alias.
Parameters:
-
name
(str
) –The name or alias of the plugin.
Returns:
-
object
(object
) –The registered plugin object.
Raises:
-
KeyError
–If no plugin with the given name or alias is registered.
Source code in src/bijux_cli/contracts/registry.py
has ¶
Checks if a plugin exists in the registry.
Parameters:
-
name
(str
) –The name or alias of the plugin.
Returns:
-
bool
(bool
) –True if the plugin is registered, False otherwise.
meta ¶
Returns metadata for a specific plugin.
Parameters:
-
name
(str
) –The name or alias of the plugin.
Returns:
-
dict[str, str]
–dict[str, str]: A dictionary containing the plugin's metadata, such as its version and alias.
Source code in src/bijux_cli/contracts/registry.py
names ¶
Returns all registered plugin names.
Returns:
-
list[str]
–list[str]: A list of the primary names of all registered plugins.
register ¶
register(
name: str,
plugin: object,
*,
alias: str | None = None,
version: str | None = None,
) -> None
Registers a plugin with the registry.
Parameters:
-
name
(str
) –The primary name of the plugin.
-
plugin
(object
) –The plugin object to register.
-
alias
(str | None
, default:None
) –An optional alias for the plugin.
-
version
(str | None
, default:None
) –An optional version string for the plugin.
Returns:
-
None
(None
) –