How to create a multi-platform build pipeline for Python? #16780
-
Nowadays multi-arch / multi-platform development workflow is a reality.
However, when it comes to building
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Yes. More accurately, pre-built wheels are required for foreign platforms. If you're on Mac and want to build a PEX that runs on Linux, you'll need the Linux-specific wheels pre-built and available on PyPI or available via a local index.
The basics are just that you need to pre-build wheels for all platforms you target and make those wheels available in a custom repo. You then point Pants at that custom repo. Say the platforms you target are Python 3.9 on MacOS ARM, Linux ARM and Linux x86_64 - that's 3 platforms. Suppose further that PEXes are only built by developers on MacOS ARM and CI that runs on Linux x86_64. And, finally, suppose that production PEXes only run on Linux ARM and x86_64. This means that on Mac you'll need pre-built Linux wheels for ARM and x86_64 and on Linux x_86_64 you'll need pre-built wheels for Linux ARM. So, you'll need to have some process that pre-builds wheels for Python 3.9 on Linux x86_64 and ARM. That process needs to run on the target architecture; so you'll need 1 job for Python 3.9 Linux x86_64 and one job for Python 3.9 on Linux ARM. That job will basically run:
Here the assumption is that You'd then merge the Say you went the NFS route and you made sure all devs and CI machines had the network share mounted at [python-repos]
repos = ["/mnt/custom-wheel"] The key would be to automate the wheel building jobs and the merge
|
Beta Was this translation helpful? Give feedback.
-
Relates to #13682 as well. |
Beta Was this translation helpful? Give feedback.
Yes. More accurately, pre-built wheels are required for foreign platforms. If you're on Mac and want to build a PEX that runs on Linux, you'll need the Linux-specific wheels pre-built and available on PyPI or available via a local index.
The basics are just that you need to pre-build wheels for all platforms you target and make those wheels available in a custom repo. You then point Pants at that custom repo.
Say the platforms you ta…