pyenv-python-provider
A subsystem for Pants-provided Python leveraging pyenv (https://github.com/pyenv/pyenv).
Enabling this subsystem will switch Pants from trying to find an appropriate Python on your system to using pyenv to install the correct Python(s).
The Pythons provided by Pyenv will be used to run any "user" code (your Python code as well as any Python-based tools you use, like black or pylint). The Pythons are also read-only to ensure they remain hermetic across runs of different tools and code.
The Pythons themselves are stored in your named_caches_dir
: https://www.pantsbuild.org/docs/reference-global#named_caches_dir under pyenv/versions/<version>
. Wiping the relevant version directory (with sudo rm -rf
) will force a re-install of Python. This may be necessary after changing something about the underlying system which changes the compiled Python, such as installing an optional-at-build-time dependency like liblzma-dev
(which is used for the optional module lzma
).
By default, the subsystem does not pass any optimization flags to the Python compilation process. Doing so would increase the time it takes to install a single Python by about an order of magnitude (E.g. ~2.5 minutes to ~26 minutes).
Backend: pants.backend.python.providers.experimental.pyenv
Config section: [pyenv-python-provider]