Skip to content
v0.1.3

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

call_hook(hook: str, *args: Any, **kwargs: Any) -> Any

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
async def call_hook(self, hook: str, *args: Any, **kwargs: Any) -> Any:
    """Invokes a hook on all registered plugins that implement it.

    Args:
        hook (str): The name of the hook to invoke.
        *args (Any): Positional arguments to pass to the hook.
        **kwargs (Any): Keyword arguments to pass to the hook.

    Returns:
        Any: The result of the hook invocation. The exact return type
            depends on the specific hook's definition and implementation.
    """
    ...

deregister

deregister(name: str) -> None

Deregisters a plugin from the registry.

Parameters:

  • name (str) –

    The name or alias of the plugin to deregister.

Returns:

  • None ( None ) –
Source code in src/bijux_cli/contracts/registry.py
def deregister(self, name: str) -> None:
    """Deregisters a plugin from the registry.

    Args:
        name (str): The name or alias of the plugin to deregister.

    Returns:
        None:
    """
    ...

get

get(name: str) -> object

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
def get(self, name: str) -> object:
    """Retrieves a plugin by its name or alias.

    Args:
        name (str): The name or alias of the plugin.

    Returns:
        object: The registered plugin object.

    Raises:
        KeyError: If no plugin with the given name or alias is registered.
    """
    ...

has

has(name: str) -> bool

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.

Source code in src/bijux_cli/contracts/registry.py
def has(self, name: str) -> bool:
    """Checks if a plugin exists in the registry.

    Args:
        name (str): The name or alias of the plugin.

    Returns:
        bool: True if the plugin is registered, False otherwise.
    """
    ...

meta

meta(name: str) -> dict[str, str]

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
def meta(self, name: str) -> dict[str, str]:
    """Returns metadata for a specific plugin.

    Args:
        name (str): The name or alias of the plugin.

    Returns:
        dict[str, str]: A dictionary containing the plugin's metadata, such
            as its version and alias.
    """
    ...

names

names() -> list[str]

Returns all registered plugin names.

Returns:

  • list[str]

    list[str]: A list of the primary names of all registered plugins.

Source code in src/bijux_cli/contracts/registry.py
def names(self) -> list[str]:
    """Returns all registered plugin names.

    Returns:
        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 ) –
Source code in src/bijux_cli/contracts/registry.py
def register(
    self,
    name: str,
    plugin: object,
    *,
    alias: str | None = None,
    version: str | None = None,
) -> None:
    """Registers a plugin with the registry.

    Args:
        name (str): The primary name of the plugin.
        plugin (object): The plugin object to register.
        alias (str | None): An optional alias for the plugin.
        version (str | None): An optional version string for the plugin.

    Returns:
        None:
    """
    ...