fix: make CIBW_ARCHS parsing case-insensitive and platform-aware#2920
Merged
Conversation
Architecture name lookup in `parse_config` was a case-sensitive StrEnum
lookup. Since the enum carries both lowercase `arm64` (macOS/Android) and
uppercase `ARM64` (Windows), `parse_config("arm64", "windows")` silently
returned the macOS member and later failed with a confusing "Invalid archs
option" error, while lowercase `amd64` failed to parse at all.
Resolve names case-insensitively, preferring a member valid for the target
platform before falling back to any case-insensitive match (which keeps the
clear ConfigurationError for genuinely invalid names).
Closes pypa#2373
Assisted-by: ClaudeCode:claude-opus-4.8
865c82c to
8bf8e69
Compare
joerick
approved these changes
Jun 18, 2026
joerick
left a comment
Contributor
There was a problem hiding this comment.
Nice, yeah I imagine this has been a little paper cut for a some people.
agriyakhetarpal
approved these changes
Jun 18, 2026
agriyakhetarpal
left a comment
Member
There was a problem hiding this comment.
Thanks! Makes sense to me. Personally, this never hit me because we documented AMD64/ARM64 in capital letters in the docs well, and I used them as such, never questioning why – but I recognise that others have been hitting it.
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.
🤖 AI text below 🤖
Problem
CIBW_ARCHSarchitecture parsing was case-sensitive and platform-ambiguous. Incibuildwheel/architecture.py,Architecture.parse_configused a case-sensitiveStrEnumlookup (cls(arch_str)). The enum carries both a lowercasearm64member (value"arm64", used by macOS/Android) and an uppercaseARM64member (value"ARM64", used by Windows), plusAMD64/x86_64, etc.This caused surprising behavior:
Architecture.parse_config("arm64", platform="windows")returned{Architecture.arm64}(the macOS member!) with no error, then failed later inallowed_architectures_checkwith a confusingInvalid archs optionmessage.Architecture.parse_config("ARM64", platform="windows")worked."amd64"(lowercase) failed to parse entirely, while"AMD64"worked.So Windows-on-ARM users had to use exact-case
ARM64/AMD64.Fix
The name lookup is now case-insensitive and resolves to the member valid for the target
platform. A new helperArchitecture._parse_arch_namefirst matches case-insensitively againstArchitecture.all_archs(platform), then falls back to a case-insensitive match across all members so the existing clearConfigurationErrorstill fires for genuinely invalid names. The special tokens (auto,native,all,auto64,auto32) are untouched.After the fix:
parse_config("arm64", "windows") == {Architecture.ARM64}parse_config("ARM64", "macos") == {Architecture.arm64}amd64/x86work on WindowsConfigurationErrorTests
Added parametrized unit tests in
unit_test/architecture_test.pycovering the cases above.Closes #2373