Skip to content

fix(pypi): don't resolve python interpreter when not necessary#3727

Merged
aignas merged 6 commits intobazel-contrib:mainfrom
rickeylev:fix-pipstar-resolve-py-interpreter
Apr 23, 2026
Merged

fix(pypi): don't resolve python interpreter when not necessary#3727
aignas merged 6 commits intobazel-contrib:mainfrom
rickeylev:fix-pipstar-resolve-py-interpreter

Conversation

@rickeylev
Copy link
Copy Markdown
Collaborator

@rickeylev rickeylev commented Apr 23, 2026

Before the PR we would not set the environment for python
interpreter if we would not need the interpreter, but we
still resolve the python interpreter, which works on some
systems that have a minimal Python installation.

With this change we stop resolving the Python interpreter
in cases were we should not need it. To ensure that we are
not accidentally using it, python_interpreter is set to
None when we use pipstar and do not do any patching, that
still requires the Python interpreter.

Fixes #3712

@rickeylev rickeylev requested review from aignas and groodt as code owners April 23, 2026 03:50
@rickeylev
Copy link
Copy Markdown
Collaborator Author

This is just the patch posted in the issue blindly applied. Lets see what CI says

Copy link
Copy Markdown
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 refactors the _whl_library_impl function in whl_library.bzl to defer Python interpreter resolution and argument construction, skipping them when pipstar extraction is used. A critical issue was identified where setting the interpreter to None would cause failures if wheel patches are present, as the subsequent patching logic requires a valid interpreter.

I am having trouble creating individual review comments. Click here to see my feedback.

python/private/pypi/whl_library.bzl (351)

high

The condition to skip python interpreter resolution should also check if whl_patches is present. If patches are defined, the patch_whl function is called later (line 406), which requires a valid python_interpreter to execute the patching logic. Setting it to None here will cause a failure when patches need to be applied.

    if enable_pipstar_extract and whl_path and not rctx.attr.whl_patches:

Comment thread python/private/pypi/whl_library.bzl Outdated
@aignas aignas added this pull request to the merge queue Apr 23, 2026
@aignas aignas mentioned this pull request Apr 23, 2026
16 tasks
Merged via the queue into bazel-contrib:main with commit ccdfc8a Apr 23, 2026
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.

enable_pipstar=True breaks extracting wheels when no python interpreter is present

2 participants