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

whl_library: reproducible wheel fetching via ctx.download (hash-pinned) — enable repo_metadata(reproducible=True), Remote Asset API and RRCC eligibility

Đang mở
#4,315 1 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 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ả

need: repro

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:

  1. 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.)
  2. The Remote Asset API downloader (--remote_downloader / FetchBlob with checksum.sri qualifiers) 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_downloader FetchBlob, 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, every ctx.download in the build becomes a single FetchBlob(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 from ctx.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

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.