bazel icon indicating copy to clipboard operation
bazel copied to clipboard

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

Open albertocavalcante opened this issue 6 months ago • 5 comments

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.

albertocavalcante avatar Jun 16 '25 07:06 albertocavalcante

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

albertocavalcante avatar Jun 16 '25 10:06 albertocavalcante

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

meteorcloudy avatar Jun 16 '25 11:06 meteorcloudy

@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 https://github.com/bazelbuild/bazel/issues/25839. Thanks again!

albertocavalcante avatar Jun 16 '25 12:06 albertocavalcante

@bazel-io fork 8.3.0

fmeum avatar Jun 16 '25 12:06 fmeum

@fmeum Thanks Fabian!

albertocavalcante avatar Jun 16 '25 12:06 albertocavalcante

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

Wyverald avatar Jun 17 '25 17:06 Wyverald