docs: clarify environment precedence (#2905)

This commit is contained in:
Himanshu Agrawal
2026-06-10 09:34:19 -04:00
committed by GitHub
parent 2f9a352352
commit 55c8985c12
2 changed files with 13 additions and 5 deletions
+6 -4
View File
@@ -64,10 +64,12 @@ You can configure cibuildwheel with a config file, such as `pyproject.toml`.
Options have the same names as the environment variable overrides, but are Options have the same names as the environment variable overrides, but are
placed in `[tool.cibuildwheel]` and are lower case, with dashes, following placed in `[tool.cibuildwheel]` and are lower case, with dashes, following
common [TOML](https://toml.io) practice. Anything placed in subsections common [TOML](https://toml.io) practice. Anything placed in subsections
named after a platform will only affect those platforms. Lists can be used named after a platform will only affect those platforms. Platform-specific
instead of strings for items that are naturally a list. Multiline strings also values replace the corresponding global value for that platform; table options
work just like in the environment variables. Environment variables will take are not merged key by key. Lists can be used instead of strings for items that
precedence if defined. are naturally a list. Multiline strings also work just like in the environment
variables. Environment variable overrides, such as `CIBW_TEST_COMMAND` and
`CIBW_TEST_COMMAND_LINUX`, will take precedence if defined.
The example above using environment variables could have been written like this: The example above using environment variables could have been written like this:
+6
View File
@@ -593,6 +593,12 @@ You must use this variable to pass variables to Linux builds, since they execute
You can use `$PATH` syntax to insert other variables, or the `$(pwd)` syntax to insert the output of other shell commands. You can use `$PATH` syntax to insert other variables, or the `$(pwd)` syntax to insert the output of other shell commands.
Variables are evaluated in the order they appear. Any variable referenced before it is set will evaluate to an empty string. Variables are evaluated in the order they appear. Any variable referenced before it is set will evaluate to an empty string.
The environment seen by the build and test steps starts with the build
environment. On Linux, this is the container environment, plus any variables
passed through with [`environment-pass`](#environment-pass). On other platforms,
the host environment is already available. Assignments in `environment` are
evaluated after that base environment and replace any duplicate variable names.
To specify more than one environment variable, separate the assignments by spaces. To specify more than one environment variable, separate the assignments by spaces.
Platform-specific environment variables are also available:<br/> Platform-specific environment variables are also available:<br/>