Skip to content

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

@albertocavalcante

Description

@albertocavalcante

Description of the feature request:

A wheel file is a ZIP file with the .whl extension, as per https://peps.python.org/pep-0427/#abstract.

I would like repository_ctx.download_and_extract to support the .whl file extension as a valid extension.

It's similar to #17824, closed by #17825.

Which category does this issue belong to?

Core

What underlying problem are you trying to solve with this feature?

I marked it as Core, but I'm not entirely sure which category it would fall into.

This is an attempt to retrieve artifacts from .whl files. The immediate use case is to retrieve uv from a wheel like uv-0.7.13-py3-none-macosx_11_0_arm64.whl.

With this implemented, I could get rules_multitool to work without changing the rule set.

This also enables other use cases and would be particularly useful for air-gapped environments, which may have private PyPI repositories with these artifacts available to be used as toolchains, but currently can't or would have to implement a solution for it.

Which operating system are you running Bazel on?

MacOS

What is the output of bazel info release?

release 8.2.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?


Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

Example on the use case:

e 151, column 42, in _env_specific_tools_impl
                rctx.download_and_extract(
Error in download_and_extract: Expected a file with a .zip, .jar, .war, .aar, .nupkg, .tar, .tar.gz, .tgz, .tar.xz, , .tar.zst, .tzst, .tar.bz2, .tbz, .ar or .deb suffix (got /private/var/tmp/_bazel_albertocavalcante/dd9c9e40657187f29a81780e6261bc31/external/rules_multitool++multitool+multitool.macos_arm64/tools/uv/macos_arm64_archive/temp17017837084274542595/uv-0.7.13-py3-none-macosx_11_0_arm64.whl)
ERROR: no such package '@@rules_multitool++multitool+multitool.macos_arm64//tools/uv': Expected a file with a .zip, .jar, .war, .aar, .nupkg, .tar, .tar.gz, .tgz, .tar.xz, , .tar.zst, .tzst, .tar.bz2, .tbz, .ar or .deb suffix (got /private/var/tmp/_bazel_username/dd9c9e40657187f29a81780e6261bc31/external/rules_multitool++multitool+multitool.macos_arm64/tools/uv/macos_arm64_archive/temp17017837084274542595/uv-0.7.13-py3-none-macosx_11_0_arm64.whl)
{
    "$schema": "https://raw.githubusercontent.com/theoremlp/rules_multitool/main/lockfile.schema.json",
    "uv": {
        "binaries": [
            {
                "kind": "archive",
                "url": "https://files.pythonhosted.org/packages/46/c7/1d7ec2211732512ae43d7176242fea3eea1915c83565953014bbafcb6be2/uv-0.7.13-py3-none-macosx_11_0_arm64.whl",
                "file": "uv-0.7.13.data/scripts/uv",
                "sha256": "4f828174e15a557d3bc0f809de76135c3b66bcbf524657f8ced9d22fc978b89c",
                "os": "macos",
                "cpu": "arm64"
            }
        ]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions