Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/pants/backend/awslambda/python/rules_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def rule_runner() -> PythonRuleRunner:
*package.rules(),
QueryRule(BuiltPackage, (PythonAwsLambdaFieldSet,)),
QueryRule(BuiltPackage, (PythonAwsLambdaLayerFieldSet,)),
QueryRule(BuiltPackage, (PexBinaryFieldSet,)),
],
target_types=[
FileTarget,
Expand Down Expand Up @@ -141,7 +142,6 @@ def complete_platform(rule_runner: PythonRuleRunner) -> bytes:
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),
Copy link
Copy Markdown
Contributor

@jsirois jsirois Jan 15, 2026

Choose a reason for hiding this comment

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

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.

check=True,
stdout=subprocess.PIPE,
).stdout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def rule_runner() -> PythonRuleRunner:
*core_target_types_rules(),
*package.rules(),
QueryRule(BuiltPackage, (PythonGoogleCloudFunctionFieldSet,)),
QueryRule(BuiltPackage, (PexBinaryFieldSet,)),
],
target_types=[
FileTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,14 @@ def create_dists(
find_links = workdir / "find-links"
subprocess.run(
args=[
pex_binary,
pex_output,
"repository",
"extract",
"--find-links",
find_links,
],
check=True,
env=os.environ.copy() | {"PEX_MODULE": "pex.tools"},
env=os.environ.copy() | {"PEX_TOOLS": "1"},
)
return find_links

Expand Down