craft_parts.plugins.python_v2.python_plugin module¶
Version 2 of the Python plugin.
- class craft_parts.plugins.python_v2.python_plugin.PythonPlugin(*, properties, part_info)[source]¶
Bases:
Plugin
Python plugin, version 2.
Unlike the original Python plugin, this one does not require the creation of virtual environments to work. Instead, it uses pip’s support for both a) installing directly into the user’s base dir and b) using a Python interpreter that is not the one running pip initially. This allows lighter payloads as the -venv package is not required, and interacts well with usrmerged directories.
The downside is that the payload generated by the plugin assumes that the primed contents will include the Python interpreter; if this is not the case, the runtime will need to add the payload to Python’s path (e.g. via PYTHONPATH).
- Parameters:
properties (
PluginProperties
)part_info (
PartInfo
)
- get_build_commands()[source]¶
Return a list of commands to run during the build step.
- Return type:
list
[str
]
- get_build_environment()[source]¶
Return a dictionary with the environment to use in the build step.
- Return type:
dict
[str
,str
]
- get_build_packages()[source]¶
Return a set of required packages to install in the build environment.
- Return type:
set
[str
]
- get_build_snaps()[source]¶
Return a set of required snaps to install in the build environment.
- Return type:
set
[str
]
- properties_class¶
alias of
PythonPluginProperties
- class craft_parts.plugins.python_v2.python_plugin.PythonPluginProperties(**data)[source]¶
Bases:
PluginProperties
The part properties used by the python plugin.
- Parameters:
data (
Any
)
- model_config: ClassVar[ConfigDict] = {'alias_generator': <function PluginProperties.<lambda>>, 'extra': 'forbid', 'frozen': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
plugin:
Literal
['python'
]¶
-
python_packages:
list
[str
]¶
-
python_requirements:
list
[str
]¶
-
source:
str
¶