-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python v2 plugin: support building parts conforming to PEP 518 #4087
Conversation
The pyright test of the
As no code change is done in snapcraft/cli.py I suppose it is an unrelated issue. |
The
which again shouldn't be related to this patch. |
If I rebase the feature branch to the current tip of the
The
|
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](ocrmypdf/OCRmyPDF@16fc520) [4]: [Install build dependencies as specified in PEP 518 by takluyver · Pull Request canonical#4144 · pypa/pip](pypa/pip#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 Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## main #4087 +/- ##
=======================================
Coverage 89.17% 89.17%
=======================================
Files 321 321
Lines 21608 21608
=======================================
Hits 19268 19268
Misses 2340 2340
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this, do you mind adding a spread test in https://github.com/snapcore/snapcraft/blob/main/tests/spread/plugins/v2/build-and-run-hello/task.yaml and contributing this same change to https://github.com/canonical/craft-parts/blob/main/craft_parts/plugins/python_plugin.py ?
Sure, I'll check it out. |
@sergiusens @brlin-tw I did the work for craft-parts. See canonical/craft-parts#435 |
@toabctl I am still not able to use pyproject.toml, did you change go through? I am using snapcraft 7.5.2 |
Did you use |
It did not work, I had to use a workaround using dephell which did. |
@brlin-tw, do you mind if I add a spread test and fix the linter failures for this PR? |
Signed-off-by: Callahan Kovacs <[email protected]>
You are free to do so, thanks for helping! Do let me know if there's anything I need to cooperate of. |
Signed-off-by: Callahan Kovacs <[email protected]>
Linter error is fixed in #4406. |
…ical#4087) LP: #2008237 Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]> Signed-off-by: Callahan Kovacs <[email protected]> Co-authored-by: Callahan Kovacs <[email protected]>
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
[2]: PEP 518 – Specifying Minimum Build System Requirements for Python Projects | peps.python.org
[3]: Drop setup.py - use pyproject.toml exclusively · ocrmypdf/OCRmyPDF@16fc520
[4]: Install build dependencies as specified in PEP 518 by takluyver · Pull Request #4144 · pypa/pip
[5]: Ubuntu – Package Search Results -- python3-pip
LP: #2008237
make lint
? (nope, but the CI tests seems to pass?)pytest tests/unit
? (nope, 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)