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
The current implementation of whl_library passes URLs parsed from simpleapi_download verbatim to rctx.download. However, some indexes (like AWS CodeArtifact) return relative URLs. This causes the bazel downloader to choke when experimental_index_url is set to an index that returns relative URLs.
Expand to show GET response for private index vs pypi
Running bazel fetch @reqs//mypy_extensions with the above files should reproduce the error below.
🔥 Exception or Error
ERROR: An error occurred during the fetch of repository 'rules_python~~pip~reqs_311_mypy_extensions_py3_none_any_4392f6c0':
Traceback (most recent call last):
File "/home/wmorrison/.cache/bazel/_bazel_wmorrison/0c20006a190ede26aadee6a87e8d620f/external/rules_python~/python/private/pypi/whl_library.bzl", line 216, column 31, in _whl_library_impl
result = rctx.download(
Error in download: java.io.IOException: Bad URL: 1.0.0/mypy_extensions-1.0.0-py3-none-any.whl
There was a recent PR in #2112 that fixed it for absolute URLs, fixing for this case should be very similar - whl_library should continue getting absolute URLs and the bug is in the parser.
This updates the simpleapi parser to handle indexes where wheel and
sdist may be an index_url relative path. It also organises the
conditionals with fewer negations so they're easier to read
Fixes: #2150
🐞 bug report
Affected Rule
The issue is caused by:
_create_wheel_repos
passing index-relative paths towhl_library
instead of full URLs.Is this a regression?
Probably not.
Description
The current implementation of
whl_library
passes URLs parsed fromsimpleapi_download
verbatim torctx.download
. However, some indexes (like AWS CodeArtifact) return relative URLs. This causes the bazel downloader to choke whenexperimental_index_url
is set to an index that returns relative URLs.Expand to show GET response for private index vs pypi
curl --basic -u "aws:$auth_token" 'https://<redacted>.d.codeartifact.eu-central-1.amazonaws.com/pypi/packages-prod/simple/mypy-extensions/'
curl 'https://pypi.org/simple/mypy-extensions/'
🔬 Minimal Reproduction
MODULE.bazel
requirements.txt
Running
bazel fetch @reqs//mypy_extensions
with the above files should reproduce the error below.🔥 Exception or Error
🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_python version:
Anything else relevant?
Related to #1357
The text was updated successfully, but these errors were encountered: