π bug report
Affected Rule
simpleapi_download.bzl β specifically _read_simpleapi and _get_dist_urls
Is this a regression?
Yes, this works in 1.7.0. The root /simple/ fetch was introduced in #3657 (commit 900d557).
Description
We're upgrading from rules_python 1.7.0 to 2.0.0-rc2 and hit an issue with a private PyPI registry on Google Artifact Registry (GAR).
In 2.0.0-rc2, simpleapi_download.bzl fetches the root /simple/ page of each index URL to discover which packages are on which index (introduced in #3657). GAR returns 404 for the root page, it only serves per-package pages like /simple/six/. ctx.download throws IOException on the 404, which kills the entire pip resolution.
We confirmed this is a GAR limitation, not an auth issue. Authenticated requests also get 404 on the root while per-package pages return 200.
We were able to work around this by patching _read_simpleapi to pass allow_fail=parse_index to ctx.download, and added a if not result.success: continue guard in _get_dist_urls, but I'm unsure how this fares for cases with experimental_extra_index_urls set.
π¬ Minimal Reproduction
- Set up a Google Artifact Registry Python repository
- Configure
pip.parse with experimental_index_url pointing to the GAR Simple API URL, or pass --index-url via extra_pip_args
- Run any
bazel build that triggers pip resolution
The root cause can be verified independently:
# Per-package page works (200)
curl -s -o /dev/null -w "%{http_code}" \
"https://<region>-python.pkg.dev/<project>/<repo>/simple/six/" \
-H "Authorization: Bearer $(gcloud auth print-access-token)"
# Root page does not (404)
curl -s -o /dev/null -w "%{http_code}" \
"https://<region>-python.pkg.dev/<project>/<repo>/simple/" \
-H "Authorization: Bearer $(gcloud auth print-access-token)"
π₯ Exception or Error
ERROR: .../simpleapi_download.bzl:258:39: Traceback (most recent call last):
...
File ".../simpleapi_download.bzl", line 164, column 43, in _get_dist_urls
results[index_url] = download.wait()
File ".../simpleapi_download.bzl", line 258, column 39, in lambda
result = download.wait(),
Error in wait: java.io.IOException: Error downloading
[https://-python.pkg.dev///simple/]
GET returned 404 Not Found
π Your Environment
Operating System:
macOS 24.5.0 (darwin arm64) / Linux (CI)
Output of bazel version:
Rules_python version:
Anything else relevant?
π bug report
Affected Rule
simpleapi_download.bzlβ specifically_read_simpleapiand_get_dist_urlsIs this a regression?
Yes, this works in 1.7.0. The root
/simple/fetch was introduced in #3657 (commit 900d557).Description
We're upgrading from rules_python 1.7.0 to 2.0.0-rc2 and hit an issue with a private PyPI registry on Google Artifact Registry (GAR).
In 2.0.0-rc2,
simpleapi_download.bzlfetches the root/simple/page of each index URL to discover which packages are on which index (introduced in #3657). GAR returns 404 for the root page, it only serves per-package pages like/simple/six/.ctx.downloadthrowsIOExceptionon the 404, which kills the entire pip resolution.We confirmed this is a GAR limitation, not an auth issue. Authenticated requests also get 404 on the root while per-package pages return 200.
We were able to work around this by patching
_read_simpleapito passallow_fail=parse_indextoctx.download, and added aif not result.success: continueguard in_get_dist_urls, but I'm unsure how this fares for cases withexperimental_extra_index_urlsset.π¬ Minimal Reproduction
pip.parsewithexperimental_index_urlpointing to the GAR Simple API URL, or pass--index-urlviaextra_pip_argsbazel buildthat triggers pip resolutionThe root cause can be verified independently:
π₯ Exception or Error
π Your Environment
Operating System:
Output of
bazel version:Rules_python version:
Anything else relevant?