Skip to content

SimpleAPI metadata check fails with private indexes #2927

Closed as not planned
Closed as not planned
@dougthor42

Description

@dougthor42

🐞 bug report

Affected Rule

pip.parse

Is this a regression?

Yes. I'm pretty sure that the change in #2695 caused the issue.

I'll see about git bisecting, but I have patches that I need to apply to get our private index to works, so a bisect is nontrivial.

Description

When using a completely private package index and experimental_index_url, the SimpleAPI metadata check fails:

$ bazel run //:gazelle_python_manifest.update
INFO: Invocation ID: 680413a2-ebcc-4b41-8312-060b4c6aeded
WARNING: Download from https://oauth2accesstoken@REDACTED/simple/h11/ failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 401 Unauthorized  
WARNING: Download from https://oauth2accesstoken@REDACTED/simple/jq/ failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 401 Unauthorized
...
ERROR: /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python~/python/private/pypi/simpleapi_download.bzl:130:14: Traceback (most recent call last):
        File "/usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python~/python/private/pypi/extension.bzl", line 642, column 25, in _pip_impl
                mods = parse_modules(module_ctx)
        File "/usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python~/python/private/pypi/extension.bzl", line 513, column 36, in parse_modules
                out = _create_whl_repos(
        File "/usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python~/python/private/pypi/extension.bzl", line 160, column 50, in _create_whl_repos
                requirements_by_platform = parse_requirements(
        File "/usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python~/python/private/pypi/parse_requirements.bzl", line 168, column 36, in parse_requirements
                index_urls = get_index_urls(
        File "/usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python~/python/private/pypi/extension.bzl", line 489, column 79, in lambda
                get_index_urls = lambda ctx, distributions: simpleapi_download(
        File "/usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python~/python/private/pypi/simpleapi_download.bzl", line 130, column 14, in simpleapi_download
                _fail(
Error in fail: Failed to download metadata for ["id", "jq", ...] for from urls: ["https://oauth2accesstoken@REDACTED/simple"].
If you would like to skip downloading metadata for these packages please add 'simpleapi_skip=[
    "id",
    "jq",
    ...
]' to your 'pip.parse' call.
ERROR: error evaluating module extension pip in @@rules_python~//python/extensions:pip.bzl

Our requirements.txt lock file has hashes in it.

It's infeasible to keep the ssimpleapi_skip list in sync with our requirements.txt file.

Is there a way to disable the metadata check? I'd be happy with applying a patch for just us - I'm already doing so to inject our registry creds (see #2640 (comment) - I haven't followed up on the netrc idea yet).

🔬 Minimal Reproduction

Hard to do unless you have a private index to test against, but the gist is "don't use public pypi at all".

🔥 Exception or Error

Error in fail: Failed to download metadata for ["id", "jq", ...] for from urls: ["https://oauth2accesstoken@REDACTED/simple"].
If you would like to skip downloading metadata for these packages please add 'simpleapi_skip=[
    "id",
    "jq",
    ...
]' to your 'pip.parse' call.
ERROR: error evaluating module extension pip in @@rules_python~//python/extensions:pip.bzl

🌍 Your Environment

Operating System:

gLinux

Output of bazel version:

$ bazel version
Bazelisk version: v1.20.0
Build label: 7.6.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Mar 31 17:08:56 2025 (1743440936)
Build timestamp: 1743440936
Build timestamp as int: 1743440936

Rules_python version:

1.4.1

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions