Skip to content

Conversation

@aignas
Copy link
Collaborator

@aignas aignas commented Nov 23, 2025

This is a small utility function to get us Python free when wheels are
extracted in the repository phase.

Next is to extract the wheel using repository_ctx.extract (#3430).

Whereas patching the wheel after extracting is more involved to be done
without Python because we need to rezip the wheel and that has to be done
with Python for a few reasons (to stay sane). If we want to remove this,
then we would have to create a whl file in the build phase, which could
work, but will need to be an exercise for the reader.

Nevertheless, this moves us towards removing any side-effects from Python
interpreter, so changing the default interpreter would not cause us to
refetch everything.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aignas, 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 significantly advances the pipstar initiative by enabling the parsing of Python wheel entry_points without relying on a Python interpreter. It achieves this by introducing a new, robust mechanism to directly read and interpret the entry_points.txt file within a wheel's metadata. The changes involve refactoring the core whl_metadata function to incorporate this new parsing, adjusting the wheel extraction flow for pipstar mode, and adding comprehensive tests to ensure the accuracy of the new parsing logic.

Highlights

  • Python-Free Entry Point Parsing: Introduced a new utility function to parse entry_points.txt directly from Python wheel metadata, eliminating the need for a Python interpreter during this specific step. This is a key part of enabling a more 'Python-free' wheel extraction process for the pipstar initiative.
  • Refactored Wheel Metadata Handling: The whl_metadata function has been enhanced to proactively read entry_points.txt (if present) and integrate its parsed content into the overall metadata struct. This streamlines how entry points are accessed downstream.
  • Conditional Wheel Extraction Logic: Modified the _extract_wheel function to include an early return when enable_pipstar is true, allowing pipstar to bypass certain dependency and metadata processing steps. This suggests a distinct, optimized path for pipstar's wheel handling.
  • Enhanced Test Coverage: Added a dedicated test case to thoroughly validate the new entry_points.txt parsing logic, ensuring correct extraction of names, modules, attributes, and extras, even with comments present.
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.

@aignas aignas force-pushed the aignas.pipstar.extract_whl_starlark branch from 7703671 to 1619825 Compare November 23, 2025 14:18
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 introduces a Starlark-based parser for entry_points.txt to avoid shelling out to Python, which is a great improvement for performance and hermeticity. The changes are primarily in whl_metadata.bzl with corresponding updates in whl_library.bzl and tests.

I've found a critical issue where a change in wheel_installer.py will cause failures in whl_library.bzl due to a leftover call. I've also identified a bug in the new entry points parser logic and a minor inaccuracy in a docstring. My review includes suggestions to fix these issues.

This is a small utility function to get us Python free when wheels are
extracted in the repository phase.

Remaining bits are:
- [ ] Extract the wheel using `repository_ctx.extract`.
- [ ] Patch the wheel after extracting.
@aignas aignas force-pushed the aignas.pipstar.extract_whl_starlark branch from 1619825 to 6461690 Compare November 23, 2025 14:22
aignas and others added 2 commits November 23, 2025 23:38
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

1 participant