-
-
Notifications
You must be signed in to change notification settings - Fork 678
pip.parse does not accept lock files with duplicated dependencies #1615
Description
🐞 bug report
Affected Rule
pip.parse
Is this a regression?
Yes, this behavior is only present when using bzlmod
Description
When using pip.parse, if a dependency is repeated in your requirements lock, you'll get an error. This is handled just fine by pip and is necessary for tools like poetry to export this way because it's possible for the same dependency to have different constraints in different parts of the dependency tree.
Ref: python-poetry/poetry#5688
🔬 Minimal Reproduction
Repo with repro here: https://github.com/AndrewGuenther/rules_python_1615_repro
The main branch uses bzlmod and workspace uses WORKSPACE. The workspace branch builds fine, but main does not. Same requirements on both branches, the only difference is bzlmod.
🔥 Exception or Error
If you try and build the example above, you'll get an error to the following effect:
ERROR: Traceback (most recent call last):
File "/home/andrew/.cache/bazel/_bazel_andrew/9ca33225fba41f1be5682708dd655aad/external/rules_python~0.27.1/python/private/bzlmod/pip.bzl", line 298, column 30, in _pip_impl
_create_whl_repos(module_ctx, pip_attr, hub_whl_map, whl_overrides)
File "/home/andrew/.cache/bazel/_bazel_andrew/9ca33225fba41f1be5682708dd655aad/external/rules_python~0.27.1/python/private/bzlmod/pip.bzl", line 129, column 20, in _create_whl_repos
whl_library(
Error in repository_rule: A repo named pip_38_pyjwt is already generated by this module extension at /home/andrew/.cache/bazel/_bazel_andrew/9ca33225fba41f1be5682708dd655aad/external/rules_python~0.27.1/python/private/bzlmod/pip.bzl:129:20
ERROR: error evaluating module extension pip in @@rules_python~0.27.1//python/extensions:pip.bzl
INFO: Elapsed time: 1.071s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
FAILED:
Fetching module extension pip in @@rules_python~0.27.1//python/extensions:pip.bzl; starting
🌍 Your Environment
Operating System:
Ubuntu
Output of bazel version:
6.4.0
Rules_python version:
0.27.1
Anything else relevant?