Plugins

Plugin registry with entry-point discovery.

nlp_shap.plugins.registry.PluginFactory

Callable that materializes a plugin instance.

alias of Callable[[], object]

class nlp_shap.plugins.registry.PluginRegistry[source]

Bases: object

Register and resolve pipeline plugins by group and name.

register(group: PluginGroup | str, name: str, factory: Callable[[], object]) None[source]

Register a plugin factory under group and name.

resolve(group: PluginGroup | str, name: str) object[source]

Instantiate a plugin registered under group and name.

names(group: PluginGroup | str) tuple[str, ...][source]

Return sorted plugin names registered for group.

load_entry_points(group: PluginGroup | str) None[source]

Discover and register plugins from a packaging entry-point group.

Plugin group identifiers for entry-point loading.

class nlp_shap.plugins.groups.PluginGroup(*values)[source]

Bases: StrEnum

Entry-point groups registered in packaging metadata.

ESTIMATORS = 'nlp_shap.estimators'

Coalition-sampling estimator plugins.

ESTIMANDS = 'nlp_shap.estimands'

Coalition payoff aggregation plugins.

VALUE_FNS = 'nlp_shap.value_fns'

Utility scoring plugins for coalition outputs.

BACKENDS = 'nlp_shap.backends'

Model inference backend plugins.

PARTITIONS = 'nlp_shap.partitions'

Player-partitioning plugins for conversation snapshots.

ABSENCE_POLICIES = 'nlp_shap.absence_policies'

Absence-policy plugins for rendering masked snapshots.

Built-in plugin registration hooks.

nlp_shap.plugins.builtin.register_builtin_plugins(registry: PluginRegistry) None[source]

Register built-in partition, absence-policy, and estimator plugins.

Plugin registry context helpers.

class nlp_shap.plugins.context.PluginContext(registry: PluginRegistry)[source]

Bases: object

Registry handle passed through pipeline setup.

registry: PluginRegistry

Plugin registry used to resolve pipeline components.