Skip to content

feat: add support for .whl file extension in repository_ctx.download_and_extract#26308

Closed
albertocavalcante wants to merge 1 commit intobazelbuild:masterfrom
albertocavalcante:add-whl-to-download-and-extract-26307
Closed

feat: add support for .whl file extension in repository_ctx.download_and_extract#26308
albertocavalcante wants to merge 1 commit intobazelbuild:masterfrom
albertocavalcante:add-whl-to-download-and-extract-26307

Conversation

@albertocavalcante
Copy link
Contributor

@albertocavalcante albertocavalcante commented Jun 16, 2025

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.

@github-actions github-actions bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Jun 16, 2025
@albertocavalcante
Copy link
Contributor Author

@meteorcloudy, can you please take a look whenever available? Thanks!

@meteorcloudy
Copy link
Member

Can you please add a new RELNOTES[New]: <content> tag in the PR description?

@meteorcloudy meteorcloudy added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jun 16, 2025
@albertocavalcante
Copy link
Contributor Author

@meteorcloudy done, thank you!

Quick question: To have it shipped on 8.3.0, I need to open another PR to https://github.com/bazelbuild/bazel/tree/release-8.3.0? I'm trying to understand #25839. Thanks again!

@fmeum
Copy link
Collaborator

fmeum commented Jun 16, 2025

@bazel-io fork 8.3.0

@albertocavalcante
Copy link
Contributor Author

@fmeum Thanks Fabian!

@Wyverald
Copy link
Member

Just wanted to point out that download_and_extract already has a type parameter, if you're blocked on this PR.

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Jun 17, 2025
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Jun 17, 2025
…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
github-merge-queue bot pushed a commit that referenced this pull request Jun 17, 2025
…x.download_and_extract` (#26323)

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

Co-authored-by: Alberto Cavalcante <[email protected]>
@albertocavalcante albertocavalcante deleted the add-whl-to-download-and-extract-26307 branch August 8, 2025 10:53
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.

Feature Request: add support for .whl file extension in download_and_extract function in repository_ctx

4 participants