python-setup
Options for Pants's Python support.
Backend: ``
Config section: [python-setup]
Basic options
None
Advanced options
interpreter_constraints
--python-setup-interpreter-constraints="[<requirement>, <requirement>, ...]"
PANTS_PYTHON_SETUP_INTERPRETER_CONSTRAINTS
[python-setup]
interpreter_constraints = [
<requirement>,
<requirement>,
...,
]
[ "CPython>=3.6" ]
The Python interpreters your codebase is compatible with.
Specify with requirement syntax, e.g. 'CPython>=2.7,<3' (A CPython interpreter with version >=2.7 AND version <3) or 'PyPy' (A pypy interpreter of any version). Multiple constraint strings will be ORed together.
These constraints are used as the default value for the interpreter_constraints
field of Python targets.
interpreter_search_paths
--python-setup-interpreter-search-paths="[<binary-paths>, <binary-paths>, ...]"
PANTS_PYTHON_SETUP_INTERPRETER_SEARCH_PATHS
[python-setup]
interpreter_search_paths = [
<binary-paths>,
<binary-paths>,
...,
]
[ "<PYENV>", "<PATH>" ]
A list of paths to search for Python interpreters that match your project's interpreter constraints. 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:
- "<PATH>", the contents of the PATH env var
- "<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
interpreter_versions_universe
--python-setup-interpreter-versions-universe="['<str>', '<str>', ...]"
PANTS_PYTHON_SETUP_INTERPRETER_VERSIONS_UNIVERSE
[python-setup]
interpreter_versions_universe = [
'<str>',
'<str>',
...,
]
[ "2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10" ]
All known Python major/minor interpreter versions that may be used by either your code or tools used by your code.
This is used by Pants to robustly handle interpreter constraints, such as knowing when telling MyPy which version to run with which Python versions to check if your code is using.
This does not control which interpreter your code will use. Instead, to set your interpreter constraints, update [python-setup].interpreter_constraints
, the interpreter_constraints
field, and relevant tool options like [isort].interpreter_constraints
to tell Pants which interpreters your code actually uses. See https://www.pantsbuild.org/v2.6/docs/python-interpreter-compatibility.
All elements must be the minor and major Python version, e.g. '2.7' or '3.10'. Do not include the patch version.
requirement_constraints
--python-setup-requirement-constraints=<file_option>
PANTS_PYTHON_SETUP_REQUIREMENT_CONSTRAINTS
[python-setup]
requirement_constraints = <file_option>
None
When resolving third-party requirements, use this constraints file to determine which versions to use.
See https://pip.pypa.io/en/stable/user_guide/#constraints-files for more information on the format of constraint files and how constraints are applied in Pex and pip.
Mutually exclusive with --requirement-constraints-target
.
resolve_all_constraints
--[no-]python-setup-resolve-all-constraints
PANTS_PYTHON_SETUP_RESOLVE_ALL_CONSTRAINTS
[python-setup]
resolve_all_constraints = <bool>
True
If enabled, when resolving requirements, Pants will first resolve your entire constraints file as a single global resolve. Then, if the code uses a subset of your constraints file, Pants will extract the relevant requirements from that global resolve so that only what's actually needed gets used. If disabled, Pants will not use a global resolve and will resolve each subset of your requirements independently.
Usually this option should be enabled because it can result in far fewer resolves.
Requires [python-setup].requirement_constraints to be set.
resolver_jobs
--python-setup-resolver-jobs=<int>
PANTS_PYTHON_SETUP_RESOLVER_JOBS
[python-setup]
resolver_jobs = <int>
#cores/2
The maximum number of concurrent jobs to build wheels with.
Because Pants can run multiple subprocesses in parallel, the maximum total parallelism will be --process-execution-{local,remote}-parallelism x --python-setup-resolver-jobs
.
Setting this option higher may result in better parallelism, but, if set too high, may result in starvation and Out of Memory errors.
resolver_manylinux
--python-setup-resolver-manylinux=<str>
PANTS_PYTHON_SETUP_RESOLVER_MANYLINUX
[python-setup]
resolver_manylinux = <str>
manylinux2014
Whether to allow resolution of manylinux wheels when resolving requirements for foreign linux platforms. The value should be a manylinux platform upper bound, e.g.: 'manylinux2010', or else the string 'no' to disallow.
Deprecated options
None
Related subsystems
None