craft_parts.plugins.plugins module¶
Definitions and helpers to handle plugins.
- craft_parts.plugins.plugins.extract_part_properties(data, *, plugin_name)[source]¶
Get common part properties without plugin-specific entries.
- Parameters:
data (
dict
[str
,Any
]) – A dictionary containing all part properties.plugin_name (
str
) – The name of the plugin.
- Return type:
dict
[str
,Any
]- Returns:
A dictionary containing only common part properties.
- craft_parts.plugins.plugins.get_plugin(*, part, part_info, properties)[source]¶
Obtain a plugin instance for the specified part.
- Parameters:
part (
Part
) – The part requesting the plugin.part_info (
PartInfo
) – The part information data.properties (
PluginProperties
) – The plugin properties.
- Return type:
- Returns:
The plugin instance.
- craft_parts.plugins.plugins.get_plugin_class(name)[source]¶
Obtain a plugin class given the name.
- Parameters:
name (
str
) – The plugin name.- Return type:
type
[Plugin
]- Returns:
The plugin class.
- Raises:
ValueError – If the plugin name is invalid.
- craft_parts.plugins.plugins.get_registered_plugins()[source]¶
Return the list of currently registered plugins.
- Return type:
dict
[str
,type
[Plugin
]]
- craft_parts.plugins.plugins.register(plugins)[source]¶
Register part handler plugins.
- Parameters:
plugins (
dict
[str
,type
[Plugin
]]) – a dictionary where the keys are plugin names and values are plugin classes. Valid plugins must subclass class:Plugin.- Return type:
None