reduce usage of PEX_MODULE when not needed#23016
Draft
cburroughs wants to merge 1 commit intopantsbuild:mainfrom
Draft
reduce usage of PEX_MODULE when not needed#23016cburroughs wants to merge 1 commit intopantsbuild:mainfrom
cburroughs wants to merge 1 commit intopantsbuild:mainfrom
Conversation
See pantsbuild@31ca16c#r174188058 Using PEX_TOOLs as we do elsewhere is less coupling to Pex's internals. AI Disclosure: An LLM was instructed to generate code to cleanup the mess it made.
jsirois
reviewed
Jan 15, 2026
| pex_executable = os.path.join(rule_runner.build_root, "pex_exe/pex_exe.pex") | ||
| return subprocess.run( | ||
| args=[pex_executable, "interpreter", "inspect", "-mt"], | ||
| env=dict(PEX_MODULE="pex.cli", **os.environ), |
Contributor
There was a problem hiding this comment.
This is incorrect. The pex_exe/pex_exe.pex is built with -c pex as the entry point, and pex interpreter ... is a hard error (Welp, not a hard error. Both interpreter and inspect get treated as requirements and -mt sets the entry point to the module t. Good luck with that!) You get away with it only because the fixture is unused. If it were used, you'd want PEX_SCRIPT="pex3" to decouple from the pex.cli module internal detail FWIW.
Also, FWIW, I started publishing Pex PEX scies a while back. These are BusyBox scies:
:; curl -fsSLO https://github.com/pex-tool/pex/releases/download/v2.81.0/pex-linux-x86_64
:; chmod +x pex-linux-x86_64
:; ./pex-linux-x86_64
Error: Could not determine which command to run.
Please select from the following boot commands:
pex
pex-tools
pex3
pexec
You can select a boot command by setting the SCIE_BOOT environment variable or else by passing it as the 1st argument.If Pants used those it could truly treat Pex as a native binary and not need to bootstrap a Python for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See
31ca16c#r174188058
Using PEX_TOOLs as we do elsewhere is less coupling to Pex's internals.
AI Disclosure: An LLM was instructed to generate code to cleanup the mess it made.