Skip to content

fix(pip): Only directly extract .whl files in Bazel >9#3452

Merged
aignas merged 2 commits intobazel-contrib:mainfrom
armandomontanez:bazel-8-whl-extraction-fix
Dec 11, 2025
Merged

fix(pip): Only directly extract .whl files in Bazel >9#3452
aignas merged 2 commits intobazel-contrib:mainfrom
armandomontanez:bazel-8-whl-extraction-fix

Conversation

@armandomontanez
Copy link
Contributor

@armandomontanez armandomontanez commented 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

Directly extracting .whl files is only supported in Bazel >=8.3.0. This
change applies the workaround for Bazel <8.0.0 to all versions <9.0.0
for broader compatibility.

Work towards bazel-contrib#2948
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @armandomontanez, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the .whl file extraction mechanism within the whl_library rule to improve compatibility across different Bazel versions. By adjusting the Bazel version check, it ensures that the direct .whl extraction method is only employed when fully supported (Bazel 9.0.0 and above), while a more robust workaround is used for older versions, thereby preventing potential build failures and enhancing the overall stability of Python dependency management.

Highlights

  • Bazel Version Check Update: The condition for directly extracting .whl files has been updated from rp_config.bazel_8_or_later to rp_config.bazel_9_or_later. This ensures that the direct extraction method is only used for Bazel versions 9.0.0 and above.
  • Broader Compatibility for .whl Extraction: This change extends the workaround (extracting .whl files via a temporary .zip archive) to cover Bazel versions less than 9.0.0, addressing compatibility issues where direct .whl extraction is not fully supported (specifically for Bazel versions between 8.0.0 and 8.3.0).
  • Temporary File Cleanup Alignment: The logic for deleting the temporary .zip file after extraction has also been updated to align with the new bazel_9_or_later check, ensuring proper cleanup when the workaround is applied.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue with directly extracting .whl files in Bazel. The change adjusts the version check from Bazel 8 to Bazel 9, applying a workaround for all Bazel versions below 9.0.0 to ensure broader compatibility, as direct extraction is only reliably supported from Bazel 8.3.0. The changes are correct and consistent. I've added one minor suggestion to improve a code comment for future clarity.

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR.

Comment on lines -380 to +383
if rp_config.bazel_8_or_later:
# Extracting .whl files requires Bazel 8.3.0 or later, so require a
# minimum of Bazel 9.0.0 to ensure compatibilty with earlier versions
# of Bazel 8.
if rp_config.bazel_9_or_later:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead do this for 8.3 and above instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmm.. Just to unbreak the older bazel versions, let me merge this.

@aignas aignas added this pull request to the merge queue Dec 11, 2025
Merged via the queue into bazel-contrib:main with commit b3d9b42 Dec 11, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants