Can I tell pants to create a pex file for a differ...
# general
p
Can I tell pants to create a pex file for a different architecture? So I can run the pex file on an arm CPU, but build it on my x86
e
Yes. See pex_binary platforms or (better) complete platforms, or, best, see environments, and in particular docker environments: + https://www.pantsbuild.org/docs/reference-pex_binary#codeplatformscode + https://www.pantsbuild.org/docs/reference-pex_binary#codecomplete_platformscode + https://www.pantsbuild.org/docs/environments The 1st two only work if there are pre-built wheels resolvable for the foreign arch. The last should just work.
p
Hmmm so all of the wheel files are in the lock for arm64. Does that mean I can ..
Copy code
pex_binary(
  name = "foo",
  dependencies=[":source"],
  complete_platforms... what goes here? Do I need to define it.
I'm looking at the environments.. it is a little confusing. It is new so I'm taking it in
Perhaps
linux_arm64
? 🤔
Hmm a github search shows: https://github.com/ebiebix/pants_sample/blob/master/src/python/pantsbuild/complete_platforms/python-38-slim-buster.json So I probably need to readup on the pex docs as the pantsdocs kind of state.
e
Yeah, there are definitely docs you could be reading here before circling back if you get stuck.