Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

unable to override https://pypi.org/simple starting in rules_python 2.0.0

Đang mở
#4,123 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu với python/extensions:pip.bzl cùng các entry point pip.default.index_url và pip.parse, sau đó tái hiện lỗi bằng bazel clean --expunge rồi đến bazel mod graph. So sánh rules_python 1.9.1 với 2.3.2, tập trung vào envsubst và URL https://pypi.org/simple đã được cấu hình. Được xem là hoàn tất khi index đã cấu hình ghi đè PyPI hoặc các tham số không còn được khuyến nghị tạo ra chẩn đoán rõ ràng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

🐞 bug report

Affected Rule
The issue is caused by the rule:

pip.parse.experimental_index_url
pip.parse.experimental_extra_index_urls
pip.default.index_url

Is this a regression?
Yes, the previous version in which this bug was not present was: 1.9.1
Description

In rules_python 1.9.1 and earlier, I was able to override the use of https://pypi.org/simple as follows:

pip.parse(
    envsubst = ["EXAMPLE_PIP_INDEX_URL"],
    experimental_extra_index_urls = [
        "${EXAMPLE_PIP_INDEX_URL}",
    ],
    experimental_index_url = "${EXAMPLE_PIP_INDEX_URL}",
    ...
)

where EXAMPLE_PIP_INDEX_URL is an environment variable that we set to our local pypi index.
We also have a --downloader_config set up which blocks access to pypi.org.

Starting with rules_python 2.0.0 and continuing through 2.3.2, the experimental_extra_index_urls and experimental_index_url parameters silently no longer work, and do not generate any diagnostic to say what the new mechanism is.

Per the documentation at https://rules-python.readthedocs.io/en/2.3.2/api/rules_python/python/extensions/pip.html#pip.default.index_url I would expect the following to work starting with rules_python 2.0.0:

pip.default(
    index_url = "${EXAMPLE_PIP_INDEX_URL}",
)
pip.parse(
    envsubst = ["EXAMPLE_PIP_INDEX_URL"],
    ...
)

However, it appears that index_url is not used at all, or at least does not override all uses of https://pypi.org/simple. The docs state that

This value is going to be subject to envsubst substitutions if necessary

I do need it to be subject to envsubst substitutions. It would be clearer if the docs said

This value is subject to envsubst substitutions

🔬 Minimal Reproduction

I can provide a small reproduction if necessary, but the user would need to supply some alternative to pypi.org to configure it with.

🔥 Exception or Error

When I run bazel clean --expunge; bazel mod graph in a repo configured as I described above, I get a diagnostic like

    Error in wait: java.io.IOException: Configured URL rewriter blocked all URLs: [https://pypi.org/simple/]
    ERROR: error evaluating module extension @@rules_python+//python/extensions:pip.bzl%pip
    ERROR: Results may be incomplete as 1 extension failed.

starting with rules_python 2.0.0 due to pypi.org/simple not being overridden any more, either by the old mechanism with experimental_index_url and experimental_extra_index_urls, or by the new mechanism with index_url.

🌍 Your Environment

Operating System:

Ubuntu 24.04

Output of bazel version:

  
$ bazelisk version
Bazelisk version: v1.19.0
Build label: 9.2.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Jul 13 18:15:04 2026 (1783966504)
Build timestamp: 1783966504
Build timestamp as int: 1783966504
  

Rules_python version:

  
2.3.2
  

Anything else relevant?

I'd be happy to attempt a fix, given some guidance as to what needed to be done where.
I'm also happy to test prospective fixes if my particular computing environment can be of some help.

It would be nice if experimental_extra_index_urls and experimental_index_url continued to work. But if they are not going to work, their use should at a minimum trigger some sort of clear diagnostic about what to use instead.

Posted on the bazel slack at https://bazelbuild.slack.com/archives/CA306CEV6/p1787963436682509

Ngôn ngữ chính
Starlark
Star
690
Fork
722
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
42

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bazel-contrib/rules_python

Tất cả issue của bazel-contrib/rules_python

Issue tương tự

Thêm issue về Build System

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.