quaint-telephone-89068
01/06/2023, 1:14 AMpex --complete-platform=cp-generated-from-target.json --resolve-local-platforms should build any pex on the builder, including any sdists.
Example where this doesn't work
• builder: PyPA official wheel builder <http://quay.io/pypa/manylinux2014_x86_64|quay.io/pypa/manylinux2014_x86_64>
• target: python:3.10-slim source
Steps to reproduce
1. Generate the complete-platform.json (py310-complete-platform.json.zip)
% docker run --platform=linux/amd64 -it python:3.10-slim /bin/bash -c 'pip3 install pex==2.1.119 --quiet --quiet --quiet; pex3 interpreter inspect --markers --tags;' > py310-complete-platform.json
2. Prepare the builder
% docker run --platform=linux/amd64 -it -v ${PWD}:/curdir <http://quay.io/pypa/manylinux2014_x86_64|quay.io/pypa/manylinux2014_x86_64>
[root@3a4bc9eae7f5 /]# export PATH=/opt/python/cp310-cp310/bin/:$PATH
[root@3a4bc9eae7f5 /]# python3.10 --version
Python 3.10.9
[root@3a4bc9eae7f5 /]# which pip3
/opt/python/cp310-cp310/bin/pip3
[root@3a4bc9eae7f5 /]# pip3 install pex
Collecting pex
Downloading pex-2.1.119-py2.py3-none-any.whl (2.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 6.0 MB/s eta 0:00:00
Installing collected packages: pex
Successfully installed pex-2.1.119
[root@3a4bc9eae7f5 curdir]# cd /curdir
[root@3a4bc9eae7f5 curdir]# export _PEX_FILE_LOCK_STYLE=bsd
3. Build the PEX (note there is no wheel for pendulum for Python 3.10)
[root@3a4bc9eae7f5 curdir]# pex --python=python3.10 --complete-platform=py310-complete-platform.json --pip-version=22.2.2 --resolver-version=pip-2020-resolver pendulum==2.1.2 -o pendulum.pex --resolve-local-platforms
pid 513 -> /root/.pex/venvs/6c59b447d0c1988f35c5942be176267a84f608a5/34acb08bef9fb9b19fe854dbe3d6bc571944def9/bin/python -sE /root/.pex/venvs/6c59b447d0c1988f35c5942be176267a84f608a5/34acb08bef9fb9b19fe854dbe3d6bc571944def9/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --isolated -q --cache-dir /root/.pex/pip_cache --log /tmp/pex-pip-log.dig57pt8/pip.log download --dest /root/.pex/downloads/resolver_download.pgnh8tee/cp310-cp310-manylinux_2_31_x86_64 --only-binary :all: pendulum==2.1.2 --index-url <https://pypi.org/simple> --retries 5 --timeout 15 exited with 1 and STDERR:
ERROR: Could not find a version that satisfies the requirement pendulum==2.1.2 (from versions: 0.3.1, 0.4, 3.0.0a1)
ERROR: No matching distribution found for pendulum==2.1.2
Alternatives tried
• using --interpreter-constraint instead of --python -> same error as above
• using --platform=manylinux2014_x86_64-cp-310-cp310 instead of --complete-platform
• build succeeded
• run succeeded - I was able to run the built pex on the target, which means this was a compatible wheel
• the built wheel was manylinux_2_17 :
unzip -l pendulum-b.pex | grep 'whl/$'
0 01-01-1980 00:00 .deps/pendulum-2.1.2-cp310-cp310-manylinux_2_17_x86_64.whl/
0 01-01-1980 00:00 .deps/python_dateutil-2.8.2-py2.py3-none-any.whl/
0 01-01-1980 00:00 .deps/pytzdata-2020.1-py2.py3-none-any.whl/
0 01-01-1980 00:00 .deps/six-1.16.0-py2.py3-none-any.whl/
pantsbuild/pexuser
01/10/2023, 12:06 AM