https://pantsbuild.org/ logo
#general
Title
# general
g

gentle-painting-24549

03/01/2023, 8:17 PM
Is it possible to ask the
pex_binary
target to build its own wheels when only sdists are available for certain dependencies? I’m passing a specific
platforms
argument to the target and it’s incompatible with a few dependencies that are only available as an sdist and not as a wheel - if possible I’d like to avoid building my own wheels and placing them on our internal PyPI server.
e

enough-analyst-54434

03/01/2023, 8:19 PM
So, are these sdists cross-platform? I.E. if you build them, are the wheels
py2-none-any
or
py3-none-any
or
py2.py3-none-any
?
If so, working on it: https://github.com/pantsbuild/pex/pull/2075 If not, that's impossible.
🙌 1
If not, what you want is probably: https://www.pantsbuild.org/docs/environments
👀 1
So, you still have to build the native wheel, Pants just lets you do it in Docker.
g

gentle-painting-24549

03/01/2023, 8:22 PM
I believe they are, the two OSS sdist only dependencies are asciitree and shortid
e

enough-analyst-54434

03/01/2023, 8:22 PM
But the other way round - no can do, No build for Mac on Linux
Ok, if they are cross platform you'll need to wait a bit. I should have Pex 2.1.125 out with this feature today. I'll add the Pants config to try it out here when it's released.
g

gentle-painting-24549

03/01/2023, 8:25 PM
Environments
would be perfect for this - all of this works when we build our PEX out on CI/CD. As a stop-gap for my M1 Mac (Intel Mac works just fine) I tried specifying the
platform
on the
pex_binary
target - but that is what introduced the sdist only issue
e

enough-analyst-54434

03/01/2023, 8:25 PM
But the real answer is do not work on a Mac if your code is meant to run on Linux!
🍎 2
The amount of industry wasted energy on this is staggering.
g

gentle-painting-24549

03/01/2023, 8:26 PM
Yeah - I agree.
e

enough-analyst-54434

03/01/2023, 8:26 PM
I'll refrain from ranting. Despite hating this. I work hard to make things work on Mac as does the rest of the Pantsbuild team. We're enablers.
g

gentle-painting-24549

03/01/2023, 8:27 PM
You’re always the one who comes up with some pretty amazing solutions to the problems that my M1 Mac causes. Thank you John!
e

enough-analyst-54434

03/02/2023, 9:02 PM
Ok, that took a bit longer than I'd hoped. If you want to try this yolo support for "cross-building" sdists you need the following
pants.toml
snippet:
Copy code
[pex-cli]
version = "v2.1.125"
known_versions = [
    "v2.1.125|macos_arm64|1da1ef933429f15b218c98c6b960f30adfd0221fc5284c1d8facac09923692f8|4080732",
    "v2.1.125|macos_x86_64|1da1ef933429f15b218c98c6b960f30adfd0221fc5284c1d8facac09923692f8|4080732",
    "v2.1.125|linux_x86_64|1da1ef933429f15b218c98c6b960f30adfd0221fc5284c1d8facac09923692f8|4080732",
    "v2.1.125|linux_arm64|1da1ef933429f15b218c98c6b960f30adfd0221fc5284c1d8facac09923692f8|4080732"
]
👀 1
5 Views