whl_library: reproducible wheel fetching via ctx.download (hash-pinned) — enable repo_metadata(reproducible=True), Remote Asset API and RRCC eligibility
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ 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
Start by reading the whl_library repository rule and the pip hub or module extension code that generates wheel repositories; the issue names these entry points but no file paths or tests. Trace how resolved wheel URLs and hashes reach pip subprocesses, then check how downloads through ctx.download affect repository metadata. Done means an opt-in mode fetches pinned wheels through Bazel's downloader and marks the repository reproducible; the issue does not identify specific tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
whl_library (and the pip hub repos it generates) fetch wheels by shelling out to pip subprocesses (pip download/pip install --download). This makes repository materialization structurally non-reproducible: the repo rule cannot declare repo_metadata(reproducible=True), and the actual downloads never flow through bazel's downloader (ctx.download).
This has two costly consequences for large repos with many wheels:
- Bazel 9.3's remote repo contents cache (
--experimental_remote_repo_contents_cache, RRCC) cannot serve pip hub repos — it only caches fetches of reproducible repositories. Every clean checkout / cold CI machine re-downloads the entire resolved wheel set from scratch. (For us: ~750 wheels, re-fetched on every cold machine, every day.) - The Remote Asset API downloader (
--remote_downloader/ FetchBlob withchecksum.sriqualifiers) never sees wheel fetches, so they cannot be deduplicated fleet-wide through a Remote Asset service / CAS.
Why this is feasible
The wheel URLs+hashes are already fully resolved and hash-pinned at generation time (lockfile / requirements with --hash= / the module extension's lock file records). A mode that performs the artifact fetch itself via ctx.download(url, sha256=...) would:
- make the repo reproducible (deterministic inputs → deterministic outputs),
- allow
repo_metadata(reproducible=True), - route downloads through bazel's downloader (URL rewriting/proxies,
--remote_downloaderFetchBlob, downloader retries), and - make wheels eligible for the RRCC remote repo contents cache.
Pip subprocesses would then only be needed for the parts that genuinely require pip (sdist builds from source, metadata extraction), or could be kept behind a flag for compatibility.
Evidence / motivation
From a JFrog data-transfer investigation on our monorepo CI (Bazel 9.3, ~750 pinned wheels per materialization):
- wheel fetches that go through the downloader are hash-pinned and could be cache-served; today every cold CI machine refetches them (~1–2 GB/day just of downloader-mode wheels, plus the pip-subprocess part which bypasses any mirror/cache entirely and goes straight to
files.pythonhosted.org— flaky under load, ReadTimeouts). - With
--experimental_remote_downloader, everyctx.downloadin the build becomes a singleFetchBlob(uris, checksum.sri)served from the fleet CAS — except wheels, which stay per-machine. - We verified the wire format end-to-end (bazel
http_header:/http_header_url:qualifiers ↔ bb-remote-asset's http fetcher) — everything is in place except the fetch not originating fromctx.download.
Ask
An opt-in mode for whl_library (or the pip hub/module extension) to fetch pre-resolved, hash-pinned wheels with ctx.download and declare repo_metadata(reproducible=True) — e.g. pip.parse(..., download_mode = "ctx_download") or similar. Happy to contribute/help test if there's interest.
Refs: #2640 (credential helper injection into pip — related plumbing, different problem).
- Ngôn ngữ chính
- Starlark
- Star
- 688
- Fork
- 728
- Merge trung bình
- 17 giờ 24 phút
- Pull request đã merge (30 ngày)
- 131
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bazel-contrib/rules_python
-
Broken links in the docsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
bazel-contrib/rules_python#4319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bazel-contrib/rules_python#4251 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bazel-contrib/rules_python#4164 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
bazel-contrib/rules_python#4311 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pip.parse ignores uv.lock dependency-edge platform markersCó thể đã có người làm @kdelalic đã nhận 6 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
bazel-contrib/rules_python#4287 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bazel-contrib/rules_python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
astral-sh/astral-codec#234 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:install bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày