← Back to issue list

python v2 plugin: support building parts conforming to PEP 518

View original Github issue

Metadata

Project
snapcraft
Number
#4087
Type
pull request
State
merged
Author
brlin-tw
Labels
—
Created
Updated
Closed

Current evaluation

Merged #4087 as 2d596621d, adding core20 Python v2 plugin support for building PEP 518 projects with pyproject.toml.

Resolution: closed resolved

Reason: Snapcraft PR #4087 was approved and merged as commit 2d596621d, enabling pip installation when a part contains pyproject.toml. Equivalent support landed in canonical/craft-parts#435 via commit 438951f7.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Currently Snapcraft only do a `pip install .` operation when the setup.py file is found in the part's source tree[1], which is no longer the case with projects adhering to PEP 518[2] as such projects may have a pyproject.toml file in their source tree instead(e.g. OCRmyPDF[3]). This patch instructs Snapcraft to run the `pip install .` command when pyproject.toml is found in the source tree, according to the pip pull request that implements the support[4] and the Ubuntu package search results[5] this should be supported since core20. [1]: [Line 143 of snapcraft/python.py at 0e2cf91 · snapcore/snapcraft · GitHub](https://github.com/snapcore/snapcraft/blob/0e2cf91/snapcraft_legacy/plugins/v2/python.py#L143) [2]: [PEP 518 – Specifying Minimum Build System Requirements for Python Projects | peps.python.org](https://peps.python.org/pep-0518/) [3]: [Drop setup.py - use pyproject.toml exclusively · ocrmypdf/OCRmyPDF@16fc520](https://github.com/ocrmypdf/OCRmyPDF/commit/16fc520) [4]: [Install build dependencies as specified in PEP 518 by takluyver · Pull Request #4144 · pypa/pip](https://github.com/pypa/pip/pull/4144) [5]: [Ubuntu – Package Search Results -- python3-pip](https://packages.ubuntu.com/search?lang=en&suite=all&exact=1&searchon=names&keywords=python3-pip) LP: [#2008237](https://bugs.launchpad.net/snapcraft/+bug/2008237) - [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `make lint`? ([nope](https://github.com/snapcore/snapcraft/pull/4087#issuecomment-1493070442), but the CI tests seems to pass?) - [ ] Have you successfully run `pytest tests/unit`? ([nope](https://github.com/snapcore/snapcraft/pull/4087#issuecomment-1493072598), but the CI tests seems to pass?) ----- Note that I don't really familiar with Python, and with software testing in general. Any help to fulfill the merge criteria is appreciated. (CRAFT-2119)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #4087 as 2d596621d, adding core20 Python v2 plugin support for building PEP 518 projects with pyproject.toml.
stealth/space-bunny-alpha — closed resolved Merged #4087 as 2d596621d, adding PEP 518 pyproject.toml support to the Python v2 plugin on core20.
qwen/qwen3.6-35b-a3b — — Merged. Adds PEP 518 pyproject.toml support to the Python v2 plugin. Approved after review, with spread tests and linter fixes completed in PR #4406 and craft-parts PR #435.
qwen3.6-35b-a3b-mtp-q6 — — Merged to enable PEP 518 pyproject.toml support in the Python v2 plugin. Requires a core22 base. Linter and test adjustments were completed in follow-up PR #4406, with parallel updates applied to craft-parts.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-parts#435 (confidence 99%)

    Merged the equivalent pyproject.toml support in the Python plugin at commit 438951f7.

  • Blocked By: canonical/snapcraft#4406 (confidence 97%)

    Fixed linter failures and unblocked finalization of PEP 518 support in #4087.

Related issues

Issue Project State Summary Similarity
#4138 core20: support PEP 518 in the python plugin snapcraft closed core20 python plugin now supports PEP 518 sources with only pyproject.toml and no setup.py, merged in PR #4087 (commit 2d596621d) and shipped in Snapcraft 8; core20 support later removed by #6241.
79%
#435 plugins: add support for pyproject.toml projects (lp:#2008237) craft-parts merged Merged pyproject.toml project support for the Python plugin into main via commit 438951f7; a mistaken 1.19.x backport was reverted.
73%
#2008237 python plugin doesn't work with pyproject.toml based projects snapcraft (launchpad) closed Added core20 support for pyproject.toml projects via #4087 and craft-parts#435; the fix shipped in Snapcraft 8 and restores packaging of console-script entry points.
71%