craft_parts.plugins.python_plugin module

The python plugin.

class craft_parts.plugins.python_plugin.PythonPlugin(*, properties, part_info)

Bases: BasePythonPlugin

A plugin to build python parts.

Parameters:
properties_class

alias of PythonPluginProperties

class craft_parts.plugins.python_plugin.PythonPluginProperties(**data)

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_constraints: list[str]

The paths to constraint files.

python_packages: list[str]

The dependencies to install from PyPI.

If needed, pip, setuptools and wheel can be upgraded here.

python_requirements: list[str]

The paths to requirements files.

Use this key when dependencies must be installed from one or more explicit requirements files, such as requirements.txt. The plugin doesn’t automatically select a requirements file from the source tree; each file must be listed here.

A part doesn’t need this key when its dependencies are already declared by the project metadata used during package installation. For example, when the source contains a setup.py or pyproject.toml file, the plugin installs the project and pip resolves the dependencies declared by the package itself. That metadata may also come from configuration files such as setup.cfg.

source: str