entity.plugins.base module

class entity.plugins.base.Plugin(resources, config=None)[source]

Bases: ABC

Base class for all plugins.

Parameters:
  • resources (dict[str, Any])

  • config (Dict[str, Any] | None)

class ConfigModel[source]

Bases: BaseModel

Default empty configuration.

class Config[source]

Bases: object

extra = 'forbid'
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

supported_stages: list[str] = []
dependencies: list[str] = []
skip_conditions: List[Callable[['PluginContext'], bool]] = []
__init__(resources, config=None)[source]

Instantiate the plugin and run all startup validations.

Parameters:
assigned_stage: str | None
validate_config()[source]

Validate config using ConfigModel and return the model.

Return type:

ValidationResult

validate_workflow(workflow)[source]

Validate that cls can run in stage before workflow execution.

Parameters:

workflow (Workflow)

Return type:

ValidationResult

should_execute(context)[source]

Determine if plugin should run for this context.

Returns:

True if the plugin should execute, False to skip.

Parameters:

context (PluginContext)

Return type:

bool

async execute(context)[source]

Run the plugin.

Parameters:

context (Any)

Return type:

Any