https://pantsbuild.org/ logo
#general
Title
# general
f

fresh-cat-90827

07/19/2021, 9:45 PM
Hi team, when having this configuration:
Copy code
[python-setup]
interpreter_constraints = ["CPython==3.6.*", "CPython==3.8.*"]
will Pants always pick up the Python
3.6.*
if both
3.6.*
and
3.8.*
are available? I’ve read that the comma separated versions would be representing the
OR
constraint, so if 3.6 is found (even if 3.8 is present as well), it will be used, but just wanted to double-check.
h

hundreds-father-404

07/20/2021, 1:40 AM
Yeah, Pex chooses the min discovered on your machine. So if you have 3.6 and 3.8 both available on your machine, Pex will go with 3.6
🙌 1
I'm wondering, are you using those constraints in reality? If so, mind sharing how come?
f

fresh-cat-90827

07/20/2021, 8:16 AM
yes, we do. 🙂 So the target usage is Linux 18.04 (with Python 3.6) and Linux 20.04 (with Python 3.8). In our CI (Linux), we run the tests with 3.6 to make sure it will work on Linux 18.04, but we also have 3.8 installed to produce PEX for 3.8. Both 3.6 and 3.8 PEX files are packaged as Debian packages to make managing installations easier. The development, however, happens on MacOS devices and we don’t want to involve additional tools such as
pyenv
to force people install Python 3.6 interpreter (however, they can if they want to). Therefore we rely on XCode 12 which provides Python 3.8.2. So if a developer didn’t explicitly make a Python 3.6 environment available on
$PATH
, then we try to fallback on the XCode’s Python 3.8.2. The same
interpreter_constraints
are used in CI as well, where it’s picking up 3.6 (as you said it goes with the minimal version). Which lets us be sure it’s Python 3.6 compatible (and no one has used a walrus operator 🙂 ). Does this make sense or have I made it more complicated than it should have been?
5 Views