Open
Description
🐞 bug report
Affected Rule
pip.parse
Is this a regression?
I don't think so
Description
Some dependencies can vary based on the current python version. In this case for requirements.txt files generated by uv or similar tools, the python version is encoded in the requirements.txt:
numpy==2.0.2 ; python_full_version < '3.10'
# via -r requirements.in
numpy==2.2.5 ; python_full_version >= '3.10'
# via -r requirements.in
In this case if you attempt to use this requirements file with pip.parse you get this error:
ERROR: /home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python+/python/private/pypi/extension.bzl:224:25: Traceback (most recent call last):
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python+/python/private/pypi/extension.bzl", line 607, column 25, in _pip_impl
mods = parse_modules(module_ctx)
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python+/python/private/pypi/extension.bzl", line 478, column 36, in parse_modules
out = _create_whl_repos(
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/46f0c9813505c30d178a2aff399354ea/external/rules_python+/python/private/pypi/extension.bzl", line 224, column 25, in _create_whl_repos
fail("Attempting to creating a duplicate library {} for {}".format(
Error in fail: Attempting to creating a duplicate library pip_311_numpy_linux_aarch64_linux_arm_linux_ppc_linux_s390x_linux_x86_64_osx_aarch64_osx_x86_64_windows_x86_64 for numpy
Ideally rules_python would know that there should only be a single repo here since these constraints are mutually exclusive
🔬 Minimal Reproduction
bazel build ...
in #2798
🌍 Your Environment
Operating System:
linux x86_64
Output of bazel version
:
8.2.1
Rules_python version: