project_config.plugins package

Project-config built-in plugins.

These plugins are not required to be specified in plugins properties of styles.

exception project_config.plugins.InvalidPluginFunction(message: str)[source]

Bases: project_config.exceptions.ProjectConfigException

Exception raised when a method of a plugin class is not valid.

message: str
class project_config.plugins.Plugins(prepare_all: bool = False)[source]

Bases: object

Plugins wrapper.

Performs all the logic concerning to plugins.

Plugins modules are loaded on demand, only when an action specified by a rule requires it, and cached for later demanding from rules.

_add_plugin_to_cache(plugin: importlib_metadata.EntryPoint) None[source]
_extract_actions_from_plugin_module(module_dotpath: str) Iterator[str][source]
_prepare_all_plugins_cache() None[source]
_prepare_default_plugins_cache() None[source]
get_function_for_action(action: str) Callable[[Any, project_config.tree.Tree, project_config.types.Rule, Optional[project_config.types.ActionsContext]], Iterator[Tuple[str, Any]]][source]

Get the function that performs an action given her name.

Parameters

action (str) – Action name whose function will be returned.

Returns

Function that process the action.

Return type

type

is_valid_action(action: str) bool[source]

Return if an action exists in available plugins.

Parameters

action (str) – Action to check for their existence.

Returns

True if the action exists, False otherwise.

Return type

bool

property plugin_action_names: Dict[str, List[str]]

Mapping of plugin names to their actions.

property plugin_names: List[str]

List of available plugin names.

prepare_3rd_party_plugin(plugin_name: str) None[source]

Prepare cache for third party plugins.

After that a plugin has been prepared can be load on demand.

Parameters

plugin_name (str) – Name of the entry point of the plugin.

Submodules