Skip to main content
Version: 2.24 (prerelease)

experimental_workspace_environment


Configuration of a "workspace" execution environment for specific platforms.

A "workspace" environment is a local environment which executes build processes within the repository and not in the usual execution sandbox. This is useful when interacting with third-party build orchestration tools which may not run correctly when run from within the Pants execution sandbox.

Environment configuration includes the platforms the environment is compatible with 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 experimental_workspace_environment may be defined in [environments-preview].names per platform, and when __local_workspace__ is specified as the environment, the experimental_workspace_environment that matches the current platform (if defined) will be selected.

Caching and reproducibility:

Pants' caching relies on all process being reproducible based solely on inputs in the repository. Processes executed in a workspace environment can easily accidentally read unexpected files, that aren't specified as a dependency. Thus, Pants puts that burden on you, the Pants user, to ensure a process output only depends on its specified input files, and doesn't read anything else.

If a process isn't reproducible, re-running a build from the same source code could fail unexpectedly, or give different output to an earlier build.

NOTE: This target type is EXPERIMENTAL and may change its semantics in subsequent Pants versions without a deprecation cycle.

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.

compatible_platforms

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.

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

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_fortran_flags when this environment target is active.

golang_cgo_gcc_binary_name

str | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_gcc_binary_name when this environment target is active.

golang_cgo_gxx_binary_name

str | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_gxx_binary_name when this environment target is active.

golang_cgo_linker_flags

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_linker_flags when this environment target is active.

golang_cgo_tool_search_paths

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_tool_search_paths when this environment target is active.

golang_external_linker_binary_name

str | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].external_linker_binary_name when this environment target is active.

golang_extra_tools

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].extra_tools when this environment target is active.

golang_go_search_paths

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].go_search_paths when this environment target is active.

golang_subprocess_env_vars

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].subprocess_env_vars when this environment target is active.

jvm_global_options

Iterable[str] | None
default: None
backend: pants.backend.experimental.scala

Overrides the default value from the option [jvm].global_options when this environment target is active.

nfpm_default_mtime

str | None
default: None
backend: pants.backend.experimental.nfpm

Overrides the default value from the option [nfpm].default_mtime when this environment target is active.

nodejs_corepack_env_vars

Iterable[str] | None
default: None
backend: pants.backend.experimental.javascript

Overrides the default value from the option [nodejs].corepack_env_vars when this environment target is active.

nodejs_executable_search_paths

Iterable[str] | None
default: None
backend: pants.backend.experimental.javascript

Overrides the default value from the option [nodejs].executable_search_paths when this environment target is active.

nodejs_search_path

Iterable[str] | None
default: None
backend: pants.backend.experimental.javascript

Overrides the default value from the option [nodejs].search_path when this environment target is active.

pex_executable_search_paths

Iterable[str] | None
default: None
backend: pants.backend.build_files.fmt.ruff

Overrides the default value from the option [pex].executable_search_paths when this environment target is active.

pyenv_python_provider_installation_extra_env_vars

Iterable[str] | None
default: None
backend: pants.backend.python.providers.experimental.pyenv

Overrides the default value from the option [pyenv-python-provider].installation_extra_env_vars when this environment target is active.

python_bootstrap_names

Iterable[str] | None
default: None
backend: pants.backend.build_files.fmt.ruff

Overrides the default value from the option [python-bootstrap].names when this environment target is active.

python_bootstrap_search_path

Iterable[str] | None
default: None
backend: pants.backend.build_files.fmt.ruff

Overrides the default value from the option [python-bootstrap].search_path when this environment target is active.

python_native_code_cpp_flags

Iterable[str] | None
default: None
backend: pants.backend.build_files.fmt.ruff

Overrides the default value from the option [python-native-code].cpp_flags when this environment target is active.

python_native_code_ld_flags

Iterable[str] | None
default: None
backend: pants.backend.build_files.fmt.ruff

Overrides the default value from the option [python-native-code].ld_flags when this environment target is active.

shell_setup_executable_search_paths

Iterable[str] | None
default: None
backend: pants.backend.experimental.makeself

Overrides the default value from the option [shell-setup].executable_search_paths when this environment target is active.

subprocess_environment_env_vars

Iterable[str] | None
default: None
backend: pants.backend.build_files.fmt.ruff

Overrides the default value from the option [subprocess-environment].env_vars when this environment target is active.

system_binaries_system_binary_paths

Iterable[str] | None
default: None
backend: pants.backend.build_files.fmt.ruff

Overrides the default value from the option [system-binaries].system_binary_paths when this environment target is active.

tags

Iterable[str] | None
default: None

Arbitrary strings to describe a target.

For example, you may tag some test targets with 'integration_test' so that you could run pants --tag='integration_test' test :: to only run on targets with that tag.

test_extra_env_vars

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [test].extra_env_vars when this environment target is active.