-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix PEP 660 metadata preparation fallback #10577
Fix PEP 660 metadata preparation fallback #10577
Conversation
4fcbe5d
to
1b34c0c
Compare
@pypa/pip-committers, @takluyver (as pep517 maintainer) I'd like to hear your opinion here. Following my late realization that pip runs setup.py develop in an isolated environment when there is a pyproject.toml, I conclude that we need to make sure that the build environment is prepared with the correct dynamic build requirements before doing metadata preparation. [added] This means that using Therefore we need to detect earlier if the build backend supports build_editable (PEP 660), i.e., before installing the build requirements, to decide if we call So I propose to add a mechanism to the pep517 library to query if the backend This actually nicely simplifies the frontend implementation, at the cost of one additional backend call to discover its capabilities. Since there might be some urgency (#10573 being a regression), I propose to keep this mechanism private between pep517 (the library) and pip for now, until we eventually design a proper mechanism for pep517 to expose backend capabilities. This is what I have done this in the second commit of this PR. Your comments are very much welcome. |
Should this be implemented as simply checking the existance of |
1b34c0c
to
f0d0045
Compare
Yep, I don't see an alternative, so I'm continuing in that direction. |
3b31f05
to
39db086
Compare
@pypa/pip-committers this is not ready to merge (see TODOs above), but this is now in good shape and ready to review and raise any concern you might have with this (which I hope there aren't many :). |
source_dir=self.unpacked_source_directory, | ||
isolated=self.isolated, | ||
details=self.name or f"from {self.link}", | ||
) |
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.
At least prepare_metadata
has become simpler.
39db086
to
f992465
Compare
e3c47e7
to
9f94a31
Compare
All done from my side, here. Now we need a pep517 release. |
FYI: once the pep517 release is made, you'll want to rebase on |
When there is a pyproject.toml, metadata preparation must be done in the isolated build environment for legacy editable installs too (fixes a regression). Also detect earlier if an editable install must go through the legacy install path, to be sure to run it in an environment with the correct build requirements.
9f94a31
to
b07a956
Compare
I vendored pep517 0.12 and rebased. |
backend does not support :pep:`660`, prepare metadata using | ||
``prepare_metadata_for_build_wheel`` instead of ``setup.py egg_info``. Also, refuse | ||
installing projects that only have a ``setup.cfg`` and no ``setup.py`` nor | ||
``pyproject.toml``. These restore the pre-21.3 behaviour. |
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.
Is the second sentence (the Also one) duplicating the 10531 fragment? I feel it should appeat only once (unfortunately Towncrier does not offer a natural way to reference two issues in one fragment).
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.
It overlaps yes. This second one specifically covers editables and accepting it was a regression in 21.3 whereas 10531 is a fix of something introduced in 21.1 or 21.2.
How does this change interact with non- |
It should be covered in $ pip install -e setuppyonly/
Obtaining file:///home/me/tmp/setuppyonly
Preparing metadata (setup.py) ... done
Installing collected packages: toto
Running setup.py develop for toto
Successfully installed toto-0.1 vs ❯ pip install -e pyproject+setupcfg/
Obtaining file:///home/me/tmp/pyproject%2Bsetupcfg
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build wheel ... done
Preparing wheel metadata (pyproject.toml) ... done
Installing collected packages: toto
Running setup.py develop for toto
Successfully installed toto-0.0.0 |
So mostly unrelated to the change made here. Thanks, that makes sense. |
Which makes me think we should print |
Do not mention wheel, as this code path is also used in legacy editable mode with isolation, where no wheel is involved. This also aligns with the new log entry for setup.py egg-info which says "Preparing metadata (setup.py)".
928fec1
to
106042f
Compare
When using pyproject.toml and the build backend does not support PEP 660, prepare metadata using build_metadata_for_build_wheel instead of setup.py egg_info. Fixes #10573.
Also fixes #10531, because this PR reworks and strengthen the detection of directories that are not python projects (i.e. they have neither a pyproject.toml nor a setup.py).
TODO