Hi! Regarding hermetic python - saw this <blogpost...
# general
a
Hi! Regarding hermetic python - saw this blogpost and
pants.backend.python.providers.experimental.pyenv
. First of all, super exciting and thank you! AFAIU, currently, this is allowing to use the hermetic python version for local runs, e.g. all of
pants run
and
pants test
. However, it seems that
pants package
still creates a pex without the hermetic version and relies on system python. Question - 1. Did I understand correctly or am i missing a functionality? 2. If i did, is it planned to use the hermetic version inside packages as welll? Thank you.
🙌 2
b
Once you package a
pex_binary
it's out of Pants' hands. the target itself has a few knobs/levers for controlling how Pex discovers interpreters and selects them. Like https://www.pantsbuild.org/docs/reference-pex_binary#codeshebangcode and https://www.pantsbuild.org/docs/reference-pex_binary#codeinterpreter_constraintscode
Python wasn't designed to be embedded. PythonBuildStandlone is the closes thing we have as a community to a relocatable Python, but it has its own quirks (the biggest being headaches with compiled modules)
a
I understand, thank you. Does it make sense to copy a standalone build into the pex (using resources for example) and point the shabang to run this version?
b
I think you might have a chicken-and-egg problem there. 🙂 You might poke around https://github.com/a-scie for a way to ship a binary that embeds PythonBuildStandalone along with a PEX. Other's have done it, and I hear there's plans for Pants to help you build this as well.
a
Perfect, thanks:)
e
@alert-psychiatrist-14102 what is your use case? Pex tracks this here: https://github.com/pantsbuild/pex/issues/2096, and although it will be a 13 years later dream realized for Pex, the coming of containers in the intervening time period seems like it has mainly killed the need; so I'm interested in use cases this continues to be useful for.
a
Hi @enough-analyst-54434! We are building a desktop application that needs access to camera and additional hardwate devices. Contenarizing is not a good option for us, as we need access to the raw drivers. Things get even more complicated when we run on macos. So we're running pex directly on the host.
e
Ok, makes sense. Thanks. The a-scie projects, a-scie/lift (
science
), may be useful then.
🙏 1
Your use case though does light a bit of a fire under https://github.com/pantsbuild/pex/issues/2096. I'll see what I can do on this work streak.
🙏 1
a
Learned more about scie - beautiful and elegant 👏