microscopic-refrigerator-69774
01/24/2023, 3:12 AMhigh-yak-85899
01/24/2023, 3:19 AMmicroscopic-refrigerator-69774
01/24/2023, 3:23 AMenough-analyst-54434
01/24/2023, 3:54 AMpex_binary
target to achieve this. You can see how far this gets you: https://www.pantsbuild.org/docs/reference-pex_binarymicroscopic-refrigerator-69774
01/24/2023, 4:54 AMenough-analyst-54434
01/24/2023, 5:29 AMpex3 interpreter inspect --markers --tag
. You want to do that for each Linux distribution you target. Ideally you can just run that command in the target container using docker. You want to be careful though to target the right Python interpreter. Some Linux distributions (or containers) have many. As the Pex docs call out, use --help
to find out more about arguments like --python
to help ensure you target the Python you intend.$ docker run -v $PWD:/share --rm -t python:3.11 bash -c 'python -mvenv pex.venv && ./pex.venv/bin/pip install -U pex && ./pex.venv/bin/pex3 interpreter inspect --python /usr/local/bin/python3.11 --markers --tags --indent 2 > /share/python3.11-complete-platform.json'
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Collecting pex
Downloading pex-2.1.121-py2.py3-none-any.whl (2.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 4.9 MB/s eta 0:00:00
Installing collected packages: pex
Successfully installed pex-2.1.121
And that plopped out a complete_platform JSON file you can use in Pants:
$ head python3.11-complete-platform.json
{
"path": "/usr/local/bin/python3.11",
"compatible_tags": [
"cp311-cp311-manylinux_2_31_x86_64",
"cp311-cp311-manylinux_2_30_x86_64",
"cp311-cp311-manylinux_2_29_x86_64",
"cp311-cp311-manylinux_2_28_x86_64",
"cp311-cp311-manylinux_2_27_x86_64",
"cp311-cp311-manylinux_2_26_x86_64",
"cp311-cp311-manylinux_2_25_x86_64",
$ tail python3.11-complete-platform.json
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "5.15.79.1-microsoft-standard-WSL2",
"platform_system": "Linux",
"platform_version": "#1 SMP Wed Nov 23 01:01:46 UTC 2022",
"python_full_version": "3.11.1",
"python_version": "3.11",
"sys_platform": "linux"
}
}