← 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. 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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Merged to enable PEP 518 pyproject.toml support in the Python v2 plugin. Pip installs build dependencies when pyproject.toml is detected, requiring core20+. Related craft-parts changes were handled separately, with final linter fixes in PR #4406.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#435 plugins: add support for pyproject.toml projects (lp:#2008237) craft-parts merged Merged to add pyproject.toml support to the craft-parts Python plugin. The change was mistakenly backported to the 1.19.x series and reverted, but remains in main and latest releases. Approved by two reviewers.
76%