Is there a way in pants v1.25 to build a pex with ...
# general
j
Is there a way in pants v1.25 to build a pex with multiple architecture dependencies (i.e. macOS and linux)? In pants v2.1.x? If this is answer in the docs, my apologies. I was not able to find the answer.
If the answer is no, has anyone solved this by building the linux pex using Docker? Are there examples out there of this?
e
Pex and Pants have supported this from 1.x days for both. I'll link some docs .... but your Docker question implies you may want more than what Pants and Pex support. They support foreign architectures only if platform specific wheels are pre-built.
It looks like the only Pants docs hinting at this are very oblique here: https://www.pantsbuild.org/docs/python-target-types#pex_binary
The
platforms
list of a
pex_binary
target namely.
I'll stop there until you can provide feedback on the pre-built wheels expectation. If you're fine with that (Pants / Pex do not have magic cross-building support) I can point you at some tools to find out platform names / tips on what platforms list to use.
j
For my immediate need, all the wheels are built and in our repo. I was just imaging using Docker to run
./pants package|binary
on a linux platform and thus pull in the "correct" pre-built wheels.
Thank you for the URL. I'll see how far I can get with that.
e
A concrete example: you're building a pex_binary meant to ship to macOs and Linux and you build that both from Apple machines and from Linux machines dependeing. In that case you'd want: platforms=["macosx-10.6-x86_64-cp-36-m", "manylinux2014-10.6-x86_64-cp-36-m"] ... for example if you consistently target CPython 3.6 on both platforms.
The trick is finding out the correct platform strings. If you run
pex --help
and look for
--platform
help, you'll get an example for the current interpreter you're running Pex with as well as a suggestion of a tool to find out more platforms.
👍 1
👨🏽‍🏫 1
w
this is a usecase that would be a truly killer app for multi-platform remoting. cc @fast-nail-55400
prepare both sets of wheels, then compose.