https://pantsbuild.org/ logo
r

refined-addition-53644

12/16/2021, 9:32 AM
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

curved-television-6568

12/16/2021, 10:42 AM
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

refined-addition-53644

12/16/2021, 11:19 AM
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

curved-television-6568

12/16/2021, 11:21 AM
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

refined-addition-53644

12/16/2021, 11:22 AM
Yikes! This seems like bit of work 😞
This would work fine in a CI/CD pipeline but for local development not so much.
c

curved-television-6568

12/16/2021, 11:30 AM
indeed, so building the pex itself in a container would solve that problem..
(just thinking out loud..)
r

refined-addition-53644

12/16/2021, 11:30 AM
yeah multi-stage build or something. This means I have to copy much more stuff in the beginning
c

curved-television-6568

12/16/2021, 11:32 AM
there are plans for supporting “remote” execution in containers.. but that’s way off into 2022…
1
h

hundreds-father-404

12/16/2021, 4:25 PM
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

gifted-soccer-38559

12/16/2021, 7:19 PM
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
3 Views