Skip to content

Conversation

henryiii
Copy link
Contributor

Error on CIBW_FREE_THREADED_SUPPORT being set. From comments on the cibuildwheel channel on Discord.

I started this with https://mini-swe-agent.com/latest/quickstart/ and this prompt:

 I’d like to add an error when the prevously removed CIBW_FREE_THREADED_SUPPORT environment variable is set. The error should point to tool.cibuildwheel.enable = [“cpython-freethreading”] in pyproject.toml, or setting the CIBW_ENABLE environment variable to cpython-freethreading as replacements. I think a good place for this would be cibuildwheel.__main__, probably similar to the detect_warnings function. The error should be logged with our logging system before stopping the run.

And it produced this:

 def detect_warnings(*, options: Options, identifiers: Iterable[str]) -> list[str]:
     warnings = []

+    # Check for deprecated CIBW_FREE_THREADED_SUPPORT environment variable
+    if "CIBW_FREE_THREADED_SUPPORT" in os.environ:
+        msg = (
+            "CIBW_FREE_THREADED_SUPPORT environment variable is no longer supported. "
+            "Use tool.cibuildwheel.enable = [\"cpython-freethreading\"] in pyproject.toml "
+            "or set CIBW_ENABLE=cpython-freethreading instead."
+        )
+        log.error(msg)
+        raise errors.ConfigurationError(msg)
+

But I went of on a different direction, refactoring the functions.

@henryiii henryiii force-pushed the henryiii/fix/erronft branch from 31d8af9 to a1a22c3 Compare July 25, 2025 15:52
@henryiii henryiii force-pushed the henryiii/fix/erronft branch from a1a22c3 to 8427af1 Compare July 26, 2025 12:19
@mayeut mayeut requested a review from Copilot July 26, 2025 16:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds error detection for the deprecated CIBW_FREE_THREADED_SUPPORT environment variable and refactors the warning/error detection system in cibuildwheel's main module.

  • Introduces a new detect_errors function to handle configuration errors that should halt execution
  • Refactors the existing detect_warnings function to use generators and removes identifier parameter
  • Adds error checking for deprecated CIBW_FREE_THREADED_SUPPORT environment variable with helpful migration guidance

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cibuildwheel/main.py Refactors warning/error detection system and adds check for deprecated CIBW_FREE_THREADED_SUPPORT
unit_test/main_tests/main_options_test.py Adds test case to verify error handling for deprecated environment variable

@mayeut mayeut merged commit 55fcb25 into pypa:main Jul 26, 2025
28 checks passed
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.

2 participants