https://pantsbuild.org/ logo
h

high-yak-85899

02/02/2022, 1:48 AM
Any thoughts on what, if any, would be the equivalent of a hermetic python in bazel for pants? We'd really like to avoid using anything on system as much as possible since it's caused us issues in the past.
w

wide-midnight-78598

02/02/2022, 3:45 AM
h

hundreds-father-404

02/02/2022, 4:43 AM
I'm nervous to say this because I know how many issues there can be getting Python to build so it could result in lots of support issues - but I would be curious to see Pants build Python for you, possibly a la Pyenv The Rules API design means that it would be fairly easy for us to swap out our current Python interpreter-discovery in favor of Python built by Pants - it's encapsulated fairly well already
We already have Pants installing Java and Scala for you iirc, along with Protoc, Shellcheck, etc I think the main places we leak out are: • discovering Python • discovering Bash to run some internal scripts • discovering unzip, zip, and tar to unpack and pack archive files • discovering Docker • when building a PEX, we default to the PATH being available because of sdists needing to be compiled
w

witty-crayon-22786

02/02/2022, 6:01 PM
@high-yak-85899: one thing that can work reasonably well, but doesn’t go as far as actually building a Python from scratch is: 1) limiting the interpreter search path to only pyenv, or only some other system python that you know is trusted, 2) bounding the version precisely to the relevant version in pyenv
1
that will unfortunately mean actually maintaining that version on user’s machines though… we can’t yet help with that.
h

high-yak-85899

02/02/2022, 6:02 PM
Okay, good to know what's possible now and that the idea is open for future versions!
5 Views