Configuration of a local execution environment for specific platforms.
Environment configuration includes the platforms the environment is compatible with, and optionally a fallback environment, along with environment-aware options (such as environment variables and search paths) used by Pants to execute processes in this environment.
To use this environment, map this target's address with a memorable name in [environments-preview].names
. You can then consume this environment by specifying the name in the environment
field defined on other targets.
Only one local_environment
may be defined in [environments-preview].names
per platform, and when __local__
is specified as the environment, the local_environment
that matches the current platform (if defined) will be selected.
Backend: pants.core
apache_thrift_thrift_search_paths
Iterable[str] | None
default: None
backend: pants.backend.codegen.thrift.apache.python
Overrides the default value from the option [apache-thrift].thrift_search_paths
when this environment target is active.
Iterable[str] | None
default: ('linux_arm64', 'linux_x86_64', 'macos_arm64', 'macos_x86_64')
Which platforms this environment can be used with.
This is used for Pants to automatically determine which environment target to use for the user's machine when the environment is set to the special value __local__
. Currently, there cannot be more than one environment target registered in [environments-preview].names
for a particular platform. If there is no environment target for a certain platform, Pants will use the options system instead to determine environment variables and executable search paths.
description
str | None
default: None
A human-readable description of the target.
Use pants list --documented ::
to see all targets with descriptions.
docker_env_vars
Iterable[str] | None
default: None
backend: pants.backend.experimental.helm
Overrides the default value from the option [docker].env_vars
when this environment target is active.
docker_executable_search_paths
Iterable[str] | None
default: None
backend: pants.backend.experimental.helm
Overrides the default value from the option [docker].executable_search_paths
when this environment target is active.
fallback_environment
str | None
default: None
The environment to fallback to when this local environment cannot be used because the field compatible_platforms
is not compatible with the local host.
Must be an environment name from the option [environments-preview].names
, the special string __local__
to use the relevant local environment, or the Python value None
to error when this specific local environment cannot be used.
Tip: when targeting Linux, it can be particularly helpful to fallback to a docker_environment
or remote_environment
target. That allows you to prefer using the local host when possible, which often has less overhead (particularly compared to Docker). If the local host is not compatible, then Pants will use Docker or remote execution to still run in a similar environment.
go_generate_env_vars
Iterable[str] | None
default: None
backend: pants.backend.experimental.go
Overrides the default value from the option [go-generate].env_vars
when this environment target is active.
golang_cgo_c_flags
Iterable[str] | None
default: None
backend: pants.backend.experimental.go
Overrides the default value from the option [golang].cgo_c_flags
when this environment target is active.
golang_cgo_cxx_flags
Iterable[str] | None
default: None
backend: pants.backend.experimental.go
Overrides the default value from the option [golang].cgo_cxx_flags
when this environment target is active.
golang_cgo_fortran_binary_name
str | None
default: None
backend: pants.backend.experimental.go
Overrides the default value from the option [golang].cgo_fortran_binary_name
when this environment target is active.
golang_cgo_fortran_flags