According to the docs, `pex_binary` will use the `...
# general
r
According to the docs,
pex_binary
will use the
interpreter_constraints
, which on my build I have:
Copy code
[python]
interpreter_constraints = ["==3.12.*"]
enable_resolves = true
However, the shebang on my
pex_binary
is
#!/usr/bin/env python3.9
. I can perhaps override it, but I'm worried that something is going wrong. I see a few other odd things that might be caused by inappropriately using 3.9 instead of 3.12, such as parse errors using black that break on lines that should be fine with 3.12. Any help on how to debug into this would be appreciated.
w
I think I saw something like this happen to me a few days ago, but I thought I was imagining it (I was also doing some pex craziness). As a sanity, would you mind re-running (if it works) with
interpreter_constraints = ["==3.11.*"]
r
Sure, let me try.
👍 1
That did work (the shebang is now 3.11), but I had to make one substantial change to compile: remove my
complete_platforms
, which indicated Python 3.12, and me manually changing that to 3.11 in a few places didn't seem to help anything.
w
Okay, this is what I was seeing - something to this effect, anyways. I had an issue packaging a pex using python 3.12, but converting to 3.11 and it worked (I also did have some
complete_platforms
shenanigans to deal with too.- but unsure if that was a blocker, or an anecdote)
r
Thank you, this gives me an interesting new datapoint. Any idea what might be going wrong, or is it just likely some pants bug? I could open an issue.
w
I'm not sure off the top of my head, because as soon as I worked around it, I promptly forgot it ever happened (literally days ago). I just assumed it was how I was messing around building SCIEs. I don't know which pex version is currently bundled with Pants, and I know there have been some shebang bugs/mods in the past few weeks - so there are a few things to look into.
💯 1
r
Changing it back to 3.12 and removing
complete_platforms
also gave a correct shebang. Weird, since my JSON file I'm using seems pretty clear about 3.12 being the python version.
w
That's an even better datapoint 🙂
r
Interesting, thanks - possibly! I'd have to see if I can repro this just using pex, which I haven't looked at yet. But if so, then this isn't indicative of any wider issues, even though I still think pants is using 3.9 sometimes when it shouldn't.
w
Well, if Pex is doing it, then Pants definitely is 🙂 But if pex isn't doing it (on 2.3.0), then it's a Pants problem. However, on top of that, it is possible that somewhere we're using the downloaded interpreter version, in lieu of the desired interpreter_constraints. I haven't run into that, other than this past week
r
Interestingly, I just ran with -
ldebug
and it gives me a json parsing error for my json file in
complete_platforms
, and even more interestingly, I see from the stacktrace that it's running 3.9. That certainly seems wrong, but I know that goals default to some other python unless you tell it otherwise. On the other hand, the docs do say it pays attention to the python interpret constraints, but that isn't generally how other goals work.
w
So, pants itself will run 3.9, for sure - is that what you're seeing?
r
Yes
Even if I supply an
interpreter_constraints
on the
pex_binary
, asking for 3.12, it runs the goal with 3.9.
c
This isn't exactly answering your question, but using
sh_boot
might be a work around: https://github.com/pantsbuild/pants/pull/19925
r
FWIW, it isn't causing me an issue at the moment, but good to know, thank you. It would be nice to have some control over what Python is running, though.