Hi, I have question regarding the `platform` optio...
# general
r
Hi, I have question regarding the
platform
option when building
pex_binary
as mentioned in the documentation. Does this mean if I build a
.pex
on macos and copy it to a docker whose base image which isn't mac, then I need to also build explicitly
.pex
compatible with the base docker image? https://www.pantsbuild.org/docs/reference-pex_binary#codeplatformscode
c
Yes, that’s right. So when building on mac, you may need something like
platforms=['linux-x86_64-cp-38-cp38']
on the
pex_binary
target.
👍 1
r
How do I ensure this? Do I manually need to build it myself?
There must be built wheels available for all of the foreign platforms, rather than sdists.
c
I think you need to build those yourself, yes.. from what I’ve overheard 😉
but most dists on pypi /should/ have wheels already, I think…
r
Yikes! This seems like bit of work 😞
This would work fine in a CI/CD pipeline but for local development not so much.
c
indeed, so building the pex itself in a container would solve that problem..
(just thinking out loud..)
r
yeah multi-stage build or something. This means I have to copy much more stuff in the beginning
c
there are plans for supporting “remote” execution in containers.. but that’s way off into 2022…
1
h
Yeah, it can be a pain to get prebuilt wheels for the
platform
. Sometimes you get lucky that every single transitive dep already releases wheels for you. Often you have to either somehow prune those deps or more realistically prebuild them
g
a manual workaround -- i have base docker image where i volume mount the repo and the host docker daemon into it and then run the build from there, this allows me to build from mac
👍 2