-
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
Avoid generating metadata in pip download --no-deps ...
#1884
Comments
The
It is a shame that the |
@xolox thanks for the detailed description, that helped me understand what was going on here. Another unfortunate side effect of the behavior reported by @tlynn is that we can't run parallel downloads for packages that share transitive dependencies. What one sees is that when using something like This is probably a convoluted example, but I figured I'd share my use case here. |
When we implement this, we should take care to prevent path traversal bugs like mentioned in #731. |
@dstufft Can this be closed since the |
I think the issue is still valid for |
I guess so. |
What about not running That would allow working around a current pylxd issue canonical/pylxd#308 (comment) |
how about additionally not running egg-info if the tarball ships an egg_info file to begin with however this should be introduced over a grace period where pip warns about differences between shipped and freshly generated |
i just ran into this when trying to use pip as sane caching downloader of other stuff |
i just tried to disable this for downloading and the issue spans resolver, preparer and a few other utilities - i will need to retry with more time |
for an sdist the internals will aways fetch a its with my limited understanding of the internals this is no longer a small saturday morning hack but rather a more nuanced re-factoring and i have to pull out |
As well as |
@RonnyPfannschmidt, I don't think we can trust |
Updated title to reflect current CLI. |
I guess this bug will be old enough to drink and vote some day ;) |
@wimglenn seems to be worse: did not work with e.g. Seriously, stuff works fine for 18 versions then basic stuff breaks... |
Yeah, confirmed as of about pip 20.1 the patch no longer suffices. I modified And it works!! OFC this was manually on my user-installed version of pip, not on top of a git repo or anything. So I don't have a patch right now, persay... |
If anyone wants to file a PR to fix this instead of complaining how this hasn't been fixed / doesn't work, that'd be appreciated. Otherwise, please understand that you're not contributing positively to this issue and making it less likely that this gets fixed (read to understand why). |
pip download --no-deps ...
Would this be mitigated if pip was able to read metadata from a PEP 621 |
It would certainly reduce the number of times we have to do a build just for metadata, so yes. No-one has yet looked at PEP 621 support in pip - apart from the obvious "no-one has been interested enough" reason, I think it's a matter of waiting until enough projects publish PEP 621 compatible metadata (and specifically dependency metadata) to make it worthwhile. Personally, I think that when setuptools starts writing PEP 621 data is probably the point at which I'd see it as worthwhile for pip (there will be a lot of projects that won't be able to generate static dependencies, even if setuptools supports them, but at least having the possibility seems like a reasonable starting point). Of course, you might feel differently about whether we should wait on a particular backend 🙂 |
No problem, I'm aware that PEP 621 usage is going to be pretty small until setuptools supports it. 🙂 |
Yea, and pypa/setuptools#1688 is sitting, waiting for someone to pick up and implement OR to provide funding for doing the necessary work on it to the PSF's Packaging-WG. :) |
FWIW, a big part of the problem here is the implementation details of working within pip's codebase. There's a concept of "preparing" a requirements, which involves downloading them and generating metadata for them. There's no separation between the two, and detangling these would likely be a non-trivial amount of work. @nchepanov (with some help from me) spent a bunch of time investigating this in Dev 2020, and the notes from that work are available above, in comments on this issue. |
Apologies, I got confused between PEP 621 (Storing project metadata in pyproject.toml) and PEP 643 (Metadata for Package Source Distributions). PEP 621 is irrelevant here, as tools should not read metadata from pyproject.toml. Reading metadata from a sdist via PEP 643 would be useful, and is valid, though. While I guess it's tempting to assume that pip can read |
Just a note that adding
fail for me in a clean environment where |
That's probably because even with |
@pfmoore It still does it even if you add |
Please see https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/#build-isolation and https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/#disabling-build-isolation. Passing |
Making some mileage on #1884 (comment) from @pfmoore I ended with the following which seems to work all right
EDIT: Added ability to
|
Locking as there's nothing immediately actionable here, and the ecosystem-level changes needed to improve the situation are already being worked on elsewhere. |
Well... it's possible to do this purely on pip's end (see #1884 (comment) and discussion immediately after that). The bit that's missing is developer resources to actually do that work, since that's closely related with how our build logic only has a single "prepare" operation that maps directly to "fetch file + generate metadata". That's something we've been chipping away at since mid 2019 (#6607, #7049). None the less, I think it's reasonable to leave this locked for a bit. :) |
As noted in an earlier comment of yours an easy way to restart discussion is if someone creates a PR with a suggested solution 🙂 |
"pip install xxx --download yyy --no-deps" runs "python setup.py egg_info" after downloading (to generate the requires.txt dependency list?). This seems unnecessary.
This is a problem in the case of "cryptography", since its setup.py uses setup_requires, which automatically downloads its dependencies at the slightest nudge, even just --help (cryptography issue #716).
This impedes using pip install --download to build a collection of trusted (checksummed) modules for later installation.
The text was updated successfully, but these errors were encountered: