feat: add CIBUILDWHEEL_BUILD_IDENTIFIER environment variable#2872
Merged
henryiii merged 2 commits intoMay 29, 2026
Conversation
Set `CIBUILDWHEEL_BUILD_IDENTIFIER` to the current build identifier
(e.g. `cp311-manylinux_x86_64`) in the environment for all per-build
steps: `before_build`, the build itself, `repair_command`,
`before_test`, and `test_command`.
This allows scripts and commands to inspect which build is currently
running, which is useful for e.g. writing per-build output files:
CIBW_TEST_COMMAND='pytest --junit-xml=results-$CIBUILDWHEEL_BUILD_IDENTIFIER.xml'
The variable is set after the user's environment overrides are applied
and is only available for per-build steps (not `before_all`, where no
single identifier applies). All six platforms are covered: linux, macOS,
Windows, pyodide, Android, and iOS.
Closes pypa#944, closes pypa#2750
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assisted-by: OpenCode:claude-sonnet-4.6
freakboy3742
approved these changes
May 27, 2026
Contributor
freakboy3742
left a comment
There was a problem hiding this comment.
The utility of script-based builds is always going to be slightly limited on iOS, but the example of an argument to pytest would definitely apply, and the general approach is straightforward.
mhsmith
reviewed
May 28, 2026
Assisted-by: OpenCode:glm-5.1 Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
mhsmith
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Human guided, AI assisted PR (using this skill). AI text below. 🤖
Summary
Closes #944, closes #2750.
Sets a new environment variable
CIBUILDWHEEL_BUILD_IDENTIFIERto the current build identifier (e.g.cp311-manylinux_x86_64) in the environment for all per-build steps:before_build, the build itself,repair_command,before_test, andtest_command.Motivation
Users need to inspect the current build identifier inside scripts and commands, for example to write per-build output files without one build overwriting another:
Design decisions
CIBW_ENVIRONMENToverrides are applied, so it reliably reflects the actual identifier.before_all, where no single identifier applies (that step runs once for a batch of builds).Assisted-by: CopilotCLI:claude-sonnet-4.6