-
Notifications
You must be signed in to change notification settings - Fork 3.1k
pip wheel should not build if the wheel already exists #855
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
Comments
So it is - I missed that, sorry. |
Works great as its own issue though. Michele's original wheel feature behaved in the non-rebuilding way. If you think about "pip wheel" as not "build a wheel" but "obtain a wheel", or introduce the confusing "pip can build a wheel from an existing wheel by doing nothing" strategy then there is less rebuilding. This strategy is also going to be important when some packages are published wheel-only and have no sdist. Does it even rebuild if you add the wheel directory to --find-links and pass --use-wheel: pip wheel --use-wheel --find-links=wheelhouse ? Clearly we'll be adding a --rebuild flag at some point. We might also want to start using the build numbers feature: wheel-1.4.0-1.tag-tag-tag.whl wheel-1.4.0-2.tag-tag-tag.whl ... |
@qwcode This feature will be really helpful. When to expect this feature? |
I would like to rephrase this issue a little bit:
As you see, building is skipped, but the roundtrip to PyPI is still there even though it has found a valid wheel already. |
That's to be expected. It doesn't know if the wheel it has is the highest version that matches the spec. It needs to discover versions. Otherwise if you built a Wheel today, in a year you'll still be building that same old version. |
Fair enough, I agree in this case. However, the same happens with exact version specification |
Unfortunately a released version can change. People are free to delete a version from PyPI and then upload a new one with the same version with different code. In |
If I understand you correctly, in a perfect system a versioned requirement would also include the exact checksum of the sdist, which also would be recorded in the built wheel or a checksum of the wheel itself, in case of sdist-less wheels. In that case a check can be performed offline, not needing a roundtip to PyPI. Unversioned requirements would be checked against PyPI and rebuilt if either a new release is available or the checksum has changed. Would this be a desirable (and implementable) scenario? |
I'm sure pip is not checking any hashes when it is "Skipping building wheel" above. Instead it will be looking for all possible links (for both sdists and wheels) for the package. It will pick the best match out of all the collected links. At this phase pip is considering individual archives and there can be multiple archives per package version. Pip would need to short-circuit the "collecting links" phase to consider only your local wheel and not the active indices. IIRC pip does not consider it but wheels also specify a build number in which case a wheel on the index could have a greater build number than your local wheel and would be preferred. |
while something like this works fine for updating only missing wheels:
i found it odd, when first using wheel, that it did not behave like "install" does with the "-d" argument, which downloads only missing source packages using this simple command (and does not install anything):
i use this to create and maintain a source package cache. imho, maintaining a wheel cache should work very similar. maybe it makes sense to change wheel to act in a similar way as "install" with only the "-w" argument and use a "--rebuild" switch to force rebuilding (or just fetching) existing wheels (even with pinned version and best using a build number instead of overwriting files). |
I looked at this briefly a while back. 2 points to consider
|
maybe it makes more sense for |
This is what I'm aiming for too. Am I right in saying that there's currently no combination of flags that will give me that behaviour? |
Is this still being worked on? Almost a year with no progress... I find the default behavior to rebuild existing wheels very surprising and AFAICS there is currently no way to use the local wheelhouse as a cache and not rebuild existing wheels but still fetch missing packages from PyPI with pip alone. |
+1 for caching by default and explicit |
Is there a way to tell wheel to compile and cache builds if they do not already exists in the current cache? I am trying to build a cache that contains binaries but it seems that for at least some packages, wheel wants to recompile them every time.
How can I make wheel to recompile only what's needed? |
I've had good success with using both
|
We, for example, wipe our wheelhouse before every build. We do this because, later in the build process, the wheelhouse is sent to a Docker container and we don't want old dependencies accumulating in there. So the Now, if Pip will cache a wheel it builds on |
I see no particular reason, this could be implemented. |
@mgeisler Thanks for the suggestion, that worked perfectly. You saved me a lot of headache. |
This appears to have been fixed:
|
Is "File was already downloaded" of In my case I have almost 50 requirements. |
Currently
downloads and builds mock twice. It would be good if it checked whether the wheel was already present, and if so did not rebuild it. This would be extremely useful for automatically maintaining local wheel caches. (A flag to force a build would also be useful, to allow building from a development source that has changed, but the version has not changed).
The text was updated successfully, but these errors were encountered: