Skip to content

Run pex on a suitable interpreter when resolving from a uv venv - #23643

Merged
benjyw merged 1 commit into
pantsbuild:mainfrom
benjyw:fix_venv_pex_creation_from_uv_venv
Aug 25, 2026
Merged

Run pex on a suitable interpreter when resolving from a uv venv#23643
benjyw merged 1 commit into
pantsbuild:mainfrom
benjyw:fix_venv_pex_creation_from_uv_venv

Conversation

@benjyw

@benjyw benjyw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Otherwise, when building a venv pex, the interpreter may not
be compatible with the originating uv venv, and will fail.

@benjyw
benjyw requested review from cburroughs and tobni August 24, 2026 05:10
req_strings = ()

venv_repos: list[VenvRepository] = []
python: PythonExecutable | None = None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To clarify: we are already setting python to non-None below in some cases, this just ensures the name always exists in this scope.

@benjyw

benjyw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Fixes #23635

@benjyw

benjyw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

This bug was introduced in #23427, where the interpreter setting was removed.

lock = Lockfile("test.lock", url_description_of_origin="test uv lockfile", resolve_name="test")
pex_data = create_pex_and_get_all_data(
rule_runner,
pex_type=VenvPex,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the bit that makes this test fail under the conditions reported in the bug.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worth a comment then?

lock = Lockfile("test.lock", url_description_of_origin="test uv lockfile", resolve_name="test")
pex_data = create_pex_and_get_all_data(
rule_runner,
pex_type=VenvPex,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worth a comment then?

@benjyw
benjyw merged commit 5ce320a into pantsbuild:main Aug 25, 2026
28 checks passed
@benjyw
benjyw deleted the fix_venv_pex_creation_from_uv_venv branch August 25, 2026 23:10
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.

3 participants