coder_plugin.base_plugin_unit

Base plugin unit for the coder_plugin system.

Defines shared fields and behaviors (logger, parent, children) for all plugins, including context management, runtime setup, and execution contract enforcement.

Classes

BasePluginUnit(*args, **kwargs)

Common base class for plugin units.

class coder_plugin.base_plugin_unit.BasePluginUnit(*args, **kwargs)[source]

Bases: object

Common base class for plugin units.

Provides shared infrastructure fields including logging, parent linkage, and child management for hierarchical plugin systems.

name

The unique identifier for this plugin class when registered with Python’s entry point system.

Type:

Optional[str]

parent_group

The entry point group under which this plugin registers itself.

Type:

Optional[str]

plugin_group

The entry point group that this plugin will own for discovering its children (if it acts as a plugin manager).

Type:

Optional[str]

logger

Logger instance attached to this plugin.

Type:

loguru.Logger

parent

The runtime parent of this plugin instance.

Type:

Optional[BasePluginUnit]

children

List of runtime-loaded child plugin instances.

Type:

List[BasePluginUnit]

__init__(*args, **kwargs)[source]

Initialize a BasePluginUnit instance.

Parameters:
  • *args (Any) – Positional arguments (currently unused).

  • **kwargs (Any) – Keyword arguments (currently unused).

run(*args, **kwargs)[source]

Run the plugin unit’s main logic.

This method must be implemented by subclasses.

Parameters:
  • *args (Any) – Positional arguments for the plugin unit’s run logic.

  • **kwargs (Any) – Keyword arguments for the plugin unit’s run logic.

Returns:

The result of the plugin unit’s execution.

Return type:

Any

Raises:

NotImplementedError – If not overridden by a subclass.

set_up(*args, **kwargs)[source]

Perform setup task(s) for this plugin unit.

This method should be overridden by subclasses to implement any required initialization logic before running the plugin.

Parameters:
  • *args (Any) – Positional arguments for the plugin unit’s set up logic.

  • **kwargs (Any) – Keyword arguments for the plugin unit’s set up logic.

Returns:

Enables fluent chaining after set up.

Return type:

Self