Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: stricter selector parsing, refactor to platforms module #2291

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joerick
Copy link
Contributor

@joerick joerick commented Feb 28, 2025

Implementation of an idea from #2070 (comment)

cibuildwheel will error out if the build config contains something that it doesn't recognise. For skip and test-skip, it just prints a warning.

This is to highlight misconfiguration as seen in #2070. Notably, the set of identifiers that cibuildwheel will consider is not dependent on platform, so users can still do a global CIBW_BUILD that's shared across platforms.

Also in this PR, I wanted to iterate through platform modules, and so decided it was time to factor them out into their own package.

I'll keep this draft to merge #2286 first, since that adds a new platform.

- Use a different method to build nothing
- Make the check aware of enable groups
@joerick joerick force-pushed the selector-strict branch 2 times, most recently from f7c0412 to 6942c47 Compare February 28, 2025 20:19
@joerick
Copy link
Contributor Author

joerick commented Feb 28, 2025

This change made the unit tests quite a bit slower (26s), so I broke out the profiler. In doing so I spotted a few places things could be sped up. I'll split out the unrelated changes to a separate PR.

@henryiii
Copy link
Contributor

Do you know why this change made it slower, though?

@joerick
Copy link
Contributor Author

joerick commented Feb 28, 2025

Yeah, it was these lines, it ended up doing a lot of TOML loading and running of the BuildSelector.

@joerick
Copy link
Contributor Author

joerick commented Feb 28, 2025

I've kept only the optimisation relevant to this change, the rest are in #2293.

Comment on lines +26 to +35
def get_platform_module(platform: PlatformName) -> PlatformModule:
if platform == "linux":
return linux
if platform == "windows":
return windows
if platform == "macos":
return macos
if platform == "pyodide":
return pyodide
assert_never(platform)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is probably not needed anymore given it's just a look-up in the ALL_PLATFORM_MODULES dict now ?

@henryiii
Copy link
Contributor

Can be rebased now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants