echoing-farmer-15630
03/08/2022, 12:58 PMFor the current interpreter at /usr/local/bin/python3.9 the full platform string is manylinux_2_28_x86_64-cp-3.9.9-cp39
... which is what you get from `pex3 interpreter inspect --all --verbose --indent 4:
{
"path": "/usr/local/bin/python3.9",
"version": "3.9.9",
"requirement": "CPython==3.9.9",
"platform": "manylinux_2_28_x86_64-cp-3.9.9-cp39",
"venv": false
}
I tried "pex3 interpreter inspect --markers --tags" and got... well, showers of things, which didn't help.
Building my pex setting platforms
to the above string errored out with PyYAML==5.4.1
(https://pypi.org/project/PyYAML/5.4.1/#files) which has cp39 manylinux1 and manylinux2014 wheels, so I can't even get past something that seems to have compatible wheels much less the problems I'm going to have when I get to source-only distributions (build a wheel in pants somehow?).
I know pants is relatively new to the Docker scene, but "build a pex that can run on docker" seems a useful thing, even if we need to spin up a container to do it. But I can't sell this to my team unless they can build locally (the old version was built entirely within Docker so worked just fine). If that's the way forward, is there a "known best way" to build a pants repository within docker that maintains some of the pants goodness like caching etc?enough-analyst-54434
03/08/2022, 3:59 PM--platform
or Pant's `pex_binary.platforms`is `linux_x86_64-cp-3.9.9-cp39`; i.e.: Drop the manylinux bit. Both Pex via --manylinux
and Pants via [python-setup] resolver_manylinux
default to assuming foreign Linux platforms are manylinux2014
compliant / compatible.
I.E.: this works
$ pex --platform=linux_x86_64-cp-3.9.9-cp39 PyYAML==5.4.1 --python-shebang "/usr/bin/env python3.9" -opyyaml.pex
$ ./pyyaml.pex -c 'import yaml; print(yaml.__file__)'
/home/jsirois/.pex/installed_wheels/345cdbb6c61904da097ad4b586d9632fac4676c8/PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl/yaml/__init__.py
pex3 interpreter inspect --markers --tags
but that shower of things would also work! You need to save that in a file and then use via --complete-platform
in Pex and via pex_binary.complete_platforms
in Pants (https://www.pantsbuild.org/v2.10/docs/reference-pex_binary#codecomplete_platformscode).$ pex3 interpreter inspect --python python3.9 --markers --tags > my_laptop.py39
$ pex --complete-platform my_laptop.py39 PyYAML==5.4.1 --python-shebang "/usr/bin/env python3.9" -opyyaml.pex
$ ./pyyaml.pex -c 'import yaml; print(yaml.__file__)'
/home/jsirois/.pex/installed_wheels/345cdbb6c61904da097ad4b586d9632fac4676c8/PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl/yaml/__init__.py
--platform
argument to Pex is very old and was always a hack. There is simply not enough information in those abbreviated platform strings to derive all data needed to solve a resolve (environment markers and all compatible tags). So using --complete-platforms
is really the way to go. It allows you to resolve exactly as if you were on the machine using the python you grabbed that complete platform data with, except for not being able to build sdists.echoing-farmer-15630
03/08/2022, 4:45 PMpex3 interpreter inspect --markers --tags
was an info string when running the pex executable within a container in a desperate effort to figure something out...
Right now I'm running down a rabbit hole with remote execution, which I think is EVENTUALLY going to be the solution (some can build a local buildfarm on their system, others can use a cloud-deployed version, and either way we get what we want: a versioned system for build tools that does something more repeatable). But I'll try the complete-platforms thing in a sec.
...sigh. Ran the pex3 interpreter inspect...
in the docker container image, did complete_platforms and this time it failed with SQLAlchemy-Paginator, which is a source dist. And we have a few more (including our own git repos). Thanks for the help but it feels like this is a bust for us; perhaps the remote execution path will be more fruitful.enough-analyst-54434
03/08/2022, 4:52 PM[python-repos] repos
or [python-repos] indexes
depending on how pre-built wheels are hosted. It's really the only way you can use --platforms
/ --complete-platforms
for any real world projects, you must invest in pre-building wheels.echoing-farmer-15630
03/08/2022, 4:54 PMenough-analyst-54434
03/08/2022, 4:55 PMechoing-farmer-15630
03/08/2022, 4:57 PM