Skip to main content
Version: 2.19 (deprecated)

python-bootstrap


Options used to locate Python interpreters.

This subsystem controls where and how Pants will locate Python, but beyond that it does not control which Python interpreter versions are actually used for your code: see the python subsystem for that.

Backend: pants.core

Config section: [python-bootstrap]

Basic options

None

Advanced options

internal_python_build_standalone_info

--python-bootstrap-internal-python-build-standalone-info="{'key1': val1, 'key2': val2, ...}"
PANTS_PYTHON_BOOTSTRAP_INTERNAL_PYTHON_BUILD_STANDALONE_INFO
pants.toml
[python-bootstrap.internal_python_build_standalone_info]
key1 = val1
key2 = val2
...
default:
{
  "linux_arm64": [
    "https://github.com/indygreg/python-build-standalone/releases/download/20230116/cpython-3.9.16+20230116-aarch64-unknown-linux-gnu-install_only.tar.gz",
    "1ba520c0db431c84305677f56eb9a4254f5097430ed443e92fc8617f8fba973d",
    23873387
  ],
  "linux_x86_64": [
    "https://github.com/indygreg/python-build-standalone/releases/download/20230116/cpython-3.9.16+20230116-x86_64-unknown-linux-gnu-install_only.tar.gz",
    "7ba397787932393e65fc2fb9fcfabf54f2bb6751d5da2b45913cb25b2d493758",
    26129729
  ],
  "macos_arm64": [
    "https://github.com/indygreg/python-build-standalone/releases/download/20230116/cpython-3.9.16+20230116-aarch64-apple-darwin-install_only.tar.gz",
    "d732d212d42315ac27c6da3e0b69636737a8d72086c980daf844344c010cab80",
    17084463
  ],
  "macos_x86_64": [
    "https://github.com/indygreg/python-build-standalone/releases/download/20230116/cpython-3.9.16+20230116-x86_64-apple-darwin-install_only.tar.gz",
    "3948384af5e8d4ee7e5ccc648322b99c1c5cf4979954ed5e6b3382c69d6db71e",
    17059474
  ]
}

A map from platform to the information needed to download Python Build Standalone.

Python Build Standalone is used to run Python-implemented Pants tools/scripts in docker environments (so that Python doesn't need to be installed).

The version of Python provided should match the default value's version, which is the highest Python Major/Minor version compatible with the Pants package's interpreter constraints. Additionally, the downloaded file should be extractable by tar using -xvf (most likely a .tar.gz file).

The schema is <string platform key>: (<string url>, <string fingerprint>, <int bytelen>) for each possible platform.

names

--python-bootstrap-names="[<python-binary-names>, <python-binary-names>, ...]"
PANTS_PYTHON_BOOTSTRAP_NAMES
pants.toml
[python-bootstrap]
names = [
<python-binary-names>,
<python-binary-names>,
...,
]
default:
[
  "python",
  "python3"
]

The names of Python binaries to search for. See the --search-path option to influence where interpreters are searched for.

This does not impact which Python interpreter is used to run your code, only what is used to run internal tools.

Can be overriden by fieldpython_bootstrap_names on local_environment, docker_environment, or remote_environmenttargets.

search_path

--python-bootstrap-search-path="[<binary-paths>, <binary-paths>, ...]"
PANTS_PYTHON_BOOTSTRAP_SEARCH_PATH
pants.toml
[python-bootstrap]
search_path = [
<binary-paths>,
<binary-paths>,
...,
]
default:
[
  "<PYENV>",
  "<ASDF>",
  "<PATH>"
]

A list of paths to search for Python interpreters.

Which interpreters are actually used from these paths is context-specific: the Python backend selects interpreters using options on the python subsystem, in particular, the [python].interpreter_constraints option.

You can specify absolute paths to interpreter binaries and/or to directories containing interpreter binaries. The order of entries does not matter.

The following special strings are supported:

For all runtime environment types:

  • <PATH>, the contents of the PATH env var

When the environment is a local_environment target:

  • <ASDF>, all Python versions currently configured by ASDF (asdf shell, ${HOME}/.tool-versions), with a fallback to all installed versions
  • <ASDF_LOCAL>, the ASDF interpreter with the version in BUILD_ROOT/.tool-versions
  • <PYENV>, all Python versions under $(pyenv root)/versions
  • <PYENV_LOCAL>, the Pyenv interpreter with the version in BUILD_ROOT/.python-version
  • <PEXRC>, paths in the PEX_PYTHON_PATH variable in /etc/pexrc or ~/.pexrc
Can be overriden by fieldpython_bootstrap_search_path on local_environment, docker_environment, or remote_environmenttargets.

Deprecated options

None

None