https://pantsbuild.org/ logo
#general
Title
# general
c

cool-yacht-37128

07/29/2022, 3:28 AM
I’m having a play with the pex multipl-platform (platforms attribute of pex_binary) support, and mostly works great. One issue I found was that I needed to set the shebang to explicitly, otherwise it would generate one that didn’t match my constraints. Is this a known issue?
pants.toml:
[python]
interpreter_constraints = [“>=3.9.2,<=3.9.13”]
The above generated a shebang of:
#!/usr/bin/env python3.10
If I run pants in the generated venv python-default I get
#!/usr/bin/env python3.9
but I didn’t expect I needed to run pants in the generated venv for it to decide which shebang to use.
e

enough-analyst-54434

07/29/2022, 4:04 AM
Have you tried
--sh-boot
?
c

cool-yacht-37128

07/29/2022, 4:48 AM
No, I haven't. I don't see this flag mentioned in the documentation. What does it do?
This is great. I tried it out by manually running pex and --sh-boot gives a great result. The resulting package is quicker to start and I don’t need to worry about the shebang line. My stuff is only used on posix compliant systems so this a win for me. Now a dumb question: How do I use it in pants? I don’t see any option for it, and I don’t see any generic args config element I can add it to.
e

enough-analyst-54434

07/29/2022, 4:11 PM
Yeah, this option will need to be added to Pants. I'm on the road currently, but you might start by filing a feature request issue on GitHub.
In the meantime, just hard-coding
shebang
is the way to go: https://www.pantsbuild.org/docs/reference-pex_binary#codeshebangcode
👍 1
4 Views