I was reading the pantsbuild blog, and noticed the post on internal python interpreter (https://blog.pantsbuild.org/two-hermetic-pythons/). I was interested in how I can build docker images that use the pants-provided python interpreter; that is, does not rely on the existence of a compatible interpreter on the docker base image. Is there any documentation on that?
04/26/2023, 11:32 AM
There are two things required for compatibility, the right Python major.minor, which you could get via a pre-built Python Build Standalone Linux binary like we do, and a compatible glibc. If you have the former but not the latter and your 3rd party dependencies include C extensions (platform specific wheels) you can still suffer incompatibility errors. See: https://peps.python.org/pep-0600/#specification
That is, I assume your intention is to have your first party python code just work on the image and that goal is inextricably linked to the glibc installed in the image if you rely on any third party python code with C extensions.