steep-waitress-53641
08/17/2021, 4:04 PMwitty-crayon-22786
08/17/2021, 4:25 PMfresh-cat-90827
08/17/2021, 4:33 PM[python-setup]
# Python that is guaranteed to be present on a MacOS device having XCode installed
interpreter_search_paths = ["/usr/bin"]
for Linux CI
[python-setup]
# the Python versions of interest are assumed to be on the $PATH in Linux CI
interpreter_search_paths.add = ["<PATH>"]
but we are somewhat lucky because developers need to have XCode installed so we know they will have Python 3.8 shim. /usr/bin/python3
provides a connection to the actual Python interpreter accessible at /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/bin/python3.8
. This means we can avoid situations when developers have other Python environments (of arbitrary Python versions) that may take priority.
Relying on homebrew’s Python is a path I would not suggest taking given how easy things break upon brew update
. The pyenv
is nice, but we can’t enforce it for every developer. So the XCode’s Python seemed like a good compromise.witty-crayon-22786
08/17/2021, 4:35 PMTheit’s possible to enforce it by setting your search path such that only pyenv interpreters are used. but yea, it can be extra steps.is nice, but we can’t enforce it for every developer.pyenv
fresh-cat-90827
08/17/2021, 4:37 PMpyenv
— an external thing is less appealing when you have a built-in XCode’s one 🙂such that only pyenv interpreters are usedthis could also be a source of confusion when people have all kinds of Python versions when running Pants, it’s nice when there is just one Python to rule them all 😉
witty-crayon-22786
08/17/2021, 4:39 PMinterpreter_constraint
to match the particular python, and a search path.fresh-cat-90827
08/17/2021, 4:44 PMwith the “use system Python”: someone on an older/newer machine will not get your one Python to rule them allOh sorry, I wasn’t clear perhaps — it’s not the Python that comes with the Mac, but rather the one that gets installed when one installs XCode. If my research was comprehensive, one is safe on Python 3.8.x with XCode 12. So if you are on XCode 12, which you need to have installed, then you are fine. Once we update the XCode across the whole fleet of machines, then it will be 3.9.x, for instance (but this is something we can control and can happen once a year for instance)
steep-waitress-53641
08/17/2021, 4:45 PMfresh-cat-90827
08/17/2021, 4:49 PMsteep-waitress-53641
08/17/2021, 4:57 PMwitty-crayon-22786
08/17/2021, 5:10 PMpantsrc
file: i use:
$ cat ~/.pants.rc
[python-setup]
# Avoid system python.
interpreter_search_paths = ["<PYENV>"]
steep-waitress-53641
08/17/2021, 5:22 PMpowerful-boots-1234
08/18/2021, 3:24 PM