You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scope pip.override to single version of referenced wheel #2263
In our project we pull in the same dependency through multiple pip.parse hubs, and they're used different places in our build graph. We want to apply a patch in 1 of those versions, but not the others. Based on the current API accepting a specific wheel name, I expected this to happen automatically, since at least in our case the wheel name includes the version etc, such that it wouldn't have any conflicts across the other downloads. I was surprised to see the other downloads start warning with RECORD mismatches because the patches are applying there too.
I propose that when using file with pip.override, only the specific matching filename is patched. And instead add a new attribute such as whl_name (mirroring pip.whl_mods) that is a simplified name that would apply to all downloads of this wheel.
where you can see it's patching the 2.3.0 version, even though the wheel name I used includes 2.4.0. It's actually really lucky that the other patch I have even applies to multiple versions.
In this case the patching actually takes a ton of time too, since this wheel is pretty large, so that's an extra downside.
Activity
aignas commentedon Oct 7, 2024
It could be a bug, so without a repro, it is hard to say. I have the same expectations as you.
keith commentedon Oct 11, 2024
You can tell it's patching both because even though I only have this in the
MODULE.bazel:I get this warning:
where you can see it's patching the 2.3.0 version, even though the wheel name I used includes 2.4.0. It's actually really lucky that the other patch I have even applies to multiple versions.
In this case the patching actually takes a ton of time too, since this wheel is pretty large, so that's an extra downside.
To repro in this project: repro.zip
Run
bazel build ..., probably has to be on a linux x86_64 box.keith commentedon Oct 11, 2024
If right here https://github.com/bazelbuild/rules_python/blob/71417c5ab792948ef87b3ce5bde0fb92be4aad83/python/private/pypi/extension.bzl#L431
I add
print(attr.file, whl_name)you can see it gets transformed fromtorch-2.4.0+cu121-cp311-cp311-linux_x86_64.whltotorchSkip wheel patching with empty patches
keith commentedon Oct 11, 2024
here's the fix: #2294
Skip wheel patching with empty patches
Skip wheel patching with empty patches
fix(pip): skip wheel patching with empty patches (#2294)