I have a question about Pex binaries, which may or...
# general
f
I have a question about Pex binaries, which may or may not make sense… we’re using Flyte (https://flyte.org/) to deploy ML workflows. Flyte expects to be able to import our code from <some location> in a docker image (I’m not totally sure where this is, but I can figure it out). My understanding is that Pex files are meant to be executables… but is there a way to import from a pex file? If not, what would be the idomatic way to use pants to put my code into a docker image?
e
You can import from a PEX file if it is on the PYTHONPATH / sys.path and you execute
import __pex__
1st or else prefix all imports served by the PEX with
__pex__.
, i.e.:
from __pex__.colors import green
.
f
Oh, interesting…
Thanks for the quick answer, again!
e
That said, that's not what you want.
With these specific Pants optimizations available: https://blog.pantsbuild.org/optimizing-python-docker-deploys-using-pants/
f
Oh, perfect, even better
I knew this had to be a solved problem 😄
Is PEX the preferred spelling?
e
Pex the tool creates PEX files. But I despise language in general and won't be offended by details like that.
f
😂 I’m the pedant on my team, so I appreciate that there is a distinction
e
I'd go all e. e. cummings and just say pex since that's what you type and what the common extension - if you use one - is. But I'm not sure how that jives with pedantry.
FWIW the original Pex author used
--indices
instead of `--indexes`but folks found that pedantry confusing so it got un-pedanted! You never know,
f
The best part about pedantry is that it’s annoying to everyone else no matter what I do 😂
😂 1
e
Hah!