Proactively build wheels for source distributions during pip install
resolution
#2703
Labels
performance
Potential performance improvement
pip install
resolution
#2703
When we
pip install
, we first run the resolver, then use the resolution to install. If we encounter a source distribution while resolving, we'll attempt to get the metadata, which may involve runningprepare_metadata_for_build_wheel
as an optimization, to skip the wheel build. After the resolution, we need to install, so we go to build the wheel, which requires creating the build environment again.This is somewhat wasteful, since we had to setup the build environment twice. If we know we'll need to include the distribution in the resolution, and we know that we're going to need to install (as in
pip install
orpip sync
, but notpip compile
), we should consider always building the distribution and avoidingprepare_metadata_for_build_wheel
.This could make sense for, e.g., direct URL distributions that we encounter during
pip install
andpip sync
resolutions.I don't know how much this matters, but it did occur to me today, since we're now doing more metadata resolutions during
pip install
. We should verify before changing anything, but in https://github.com/timothyjlaurent/uv-poetry-monorepo-mre, my estimate is that it cost us about 150ms.The text was updated successfully, but these errors were encountered: