Skip to content

[8.3.0] feat: add support for .whl file extension in repository_ctx.download_and_extract#26323

Merged
Wyverald merged 1 commit intobazelbuild:release-8.3.0from
bazel-io:cp26308-8.3.0
Jun 17, 2025
Merged

[8.3.0] feat: add support for .whl file extension in repository_ctx.download_and_extract#26323
Wyverald merged 1 commit intobazelbuild:release-8.3.0from
bazel-io:cp26308-8.3.0

Conversation

@bazel-io
Copy link
Member

The download_and_extract function supported various archive formats, but did not recognize .whl as a valid file extension for archive extraction. Since wheel files are ZIP archives with a .whl extension (per PEP 427), this commit adds support for them by treating .whl files the same as other ZIP-based formats.

This enables using Python wheel files directly with rules_multitool and other tools without requiring workarounds, particularly useful for air-gapped environments with private PyPI repositories.

Changes:

  • Add .whl to ZIP decompressor condition in DecompressorValue.java
  • Update error message to include .whl in supported extensions list
  • Update API documentation to include .whl as supported archive type
  • Add test case for .whl file extension handling

Fixes #26307

RELNOTES[NEW]: repository_ctx.download_and_extract now supports the .whl file extension for Python wheel files, treating them as ZIP archives under PEP 427.

Closes #26308.

PiperOrigin-RevId: 772552704
Change-Id: Id21218bb7f13096e0e493745a18325a2575445ed

Commit d9634ca

…ad_and_extract`

The `download_and_extract` function supported various archive formats, but did not recognize `.whl` as a valid file extension for archive extraction. Since wheel files are ZIP archives with a `.whl` extension (per PEP 427), this commit adds support for them by treating `.whl` files the same as other ZIP-based formats.

This enables using Python wheel files directly with rules_multitool and other tools without requiring workarounds, particularly useful for air-gapped environments with private PyPI repositories.

Changes:
- Add .whl to ZIP decompressor condition in DecompressorValue.java
- Update error message to include .whl in supported extensions list
- Update API documentation to include .whl as supported archive type
- Add test case for .whl file extension handling

Fixes bazelbuild#26307

RELNOTES[NEW]: `repository_ctx.download_and_extract` now supports the `.whl` file extension for Python wheel files, treating them as ZIP archives under PEP 427.

Closes bazelbuild#26308.

PiperOrigin-RevId: 772552704
Change-Id: Id21218bb7f13096e0e493745a18325a2575445ed
@bazel-io bazel-io requested a review from a team as a code owner June 17, 2025 18:31
@bazel-io bazel-io added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Jun 17, 2025
@bazel-io bazel-io requested a review from meteorcloudy June 17, 2025 18:31
@Wyverald Wyverald enabled auto-merge June 17, 2025 18:38
@Wyverald Wyverald added this pull request to the merge queue Jun 17, 2025
Merged via the queue into bazelbuild:release-8.3.0 with commit 13ede51 Jun 17, 2025
47 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jun 17, 2025
github-merge-queue bot pushed a commit to bazel-contrib/rules_python that referenced this pull request Dec 11, 2025
Directly extracting .whl files is only supported in Bazel >=8.3.0 (see
bazelbuild/bazel#26323). This change applies the
workaround for Bazel <8.0.0 to all versions <9.0.0 for broader
compatibility.

Work towards #2948
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants