Pants v2: Fast, consistent builds for Python and more

Welcome to the Pants v2 documentation hub!

Pants v2 is a fast, scalable build system for growing codebases. It's currently focused on Python, with support for other languages coming soon.

Here you'll find guides to help you get started with Pants v2, comprehensive documentation on how to configure, run and customize Pants v2, and information on how to get help from the Pants community.

Get Started

python-setup

A Python environment.

Config section: [python-setup]

Basic options

None

Advanced options

--python-setup-interpreter-constraints="[<requirement>, <requirement>, ...]"
PANTS_PYTHON_SETUP_INTERPRETER_CONSTRAINTS
interpreter_constraints
default:
[
  "CPython>=3.6"
]

Constrain the selected Python interpreter. 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 applied in addition to any compatibilities required by the relevant targets.

--python-setup-requirement-constraints=<file_option>
PANTS_PYTHON_SETUP_REQUIREMENT_CONSTRAINTS
requirement_constraints
default: 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.

--python-setup-resolve-all-constraints=<ResolveAllConstraintsOption>
PANTS_PYTHON_SETUP_RESOLVE_ALL_CONSTRAINTS
resolve_all_constraints
one of: never, nondeployables, always
default: nondeployables
If set, and the requirements of the code being operated on are a subset of the constraints file, then the entire constraints file will be used instead of the subset. If unset, or any requirement of the code being operated on is not in the constraints file, each subset will be independently resolved as needed, which is more correct - work is only invalidated if a requirement it actually depends on changes - but also a lot slower, due to the extra resolving. You may wish to leave this option set for normal work, such as running tests, but selectively turn it off via command-line-flag when building deployable binaries, so that you only deploy the requirements you actually need for a given binary. Requires [python-setup].requirement_constraints to be set.

--python-setup-interpreter-search-paths="[<binary-paths>, <binary-paths>, ...]"
PANTS_PYTHON_SETUP_INTERPRETER_SEARCH_PATHS
interpreter_search_paths
default:
[
  "<PEXRC>",
  "<PATH>"
]

A list of paths to search for python interpreters. The following special strings are supported: "<PATH>" (the contents of the PATH env var), "<PEXRC>" (paths in the PEX_PYTHON_PATH variable in a pexrc file), "<PYENV>" (all python versions under $(pyenv root)/versions)."<PYENV_LOCAL>" (the python version in BUILD_ROOT/.python-version).

--python-setup-resolver-manylinux=<str>
PANTS_PYTHON_SETUP_RESOLVER_MANYLINUX
resolver_manylinux
default: 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 [Ff]alse, [Nn]o or [Nn]one to disallow.

--python-setup-resolver-jobs=<int>
PANTS_PYTHON_SETUP_RESOLVER_JOBS
resolver_jobs
default: 2
The maximum number of concurrent jobs to build wheels with. Because Pants can run multiple subprocesses in parallel, the 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.

Deprecated options

--python-setup-platforms="[<platform>, <platform>, ...]"
PANTS_PYTHON_SETUP_PLATFORMS
platforms
default:
[
  "current"
]

Deprecated, will be removed in version: 2.1.0.dev0.
The option `--python-setup-platforms` does not do anything anymore. Instead, explicitly set the `platforms` field on each `python_binary`.
A list of platforms to be supported by this Python environment. Each platformis a string, as returned by pkg_resources.get_supported_platform().

--python-setup-interpreter-cache-dir=<dir>
PANTS_PYTHON_SETUP_INTERPRETER_CACHE_DIR
interpreter_cache_dir
default: None
Deprecated, will be removed in version: 2.1.0.dev0.
The option `--python-setup-interpreter-cache-dir` does not do anything anymore.Instead, use the global option `--named-caches-dir`.
The parent directory for the interpreter cache. If unspecified, a standard path under the workdir is used.

--python-setup-resolver-cache-dir=<dir>
PANTS_PYTHON_SETUP_RESOLVER_CACHE_DIR
resolver_cache_dir
default: None
Deprecated, will be removed in version: 2.1.0.dev0.
The option `--python-setup-resolver-cache-dir` does not do anything anymore. Instead, use the global option `--named-caches-dir`.
The parent directory for the requirement resolver cache. If unspecified, a standard path under the workdir is used.

--[no-]python-setup-resolver-allow-prereleases
PANTS_PYTHON_SETUP_RESOLVER_ALLOW_PRERELEASES
resolver_allow_prereleases
default: None
Deprecated, will be removed in version: 2.1.0.dev0.
The option `--python-setup-resolver-allow-prereleases` does not no anything. To use a pre-release, explicitly use that pre-release version in your requirement string, e.g. `my_dist==99.0.dev0`.
Whether to include pre-releases when resolving requirements.

Updated about a month ago


python-setup


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.