From 7c3b0fbee8d7cb8d065a50d12b206978204a8238 Mon Sep 17 00:00:00 2001 From: Matthieu Darbois Date: Fri, 25 Oct 2024 22:07:29 +0200 Subject: [PATCH] chore: add warning when running cibuildwheel with python<3.11 (#2050) * chore: add warning when running cibuildwheel with python<3.11 * fix: use `log.warning` to print warnings in `print_preamble` * Better warning & doc update * address review comments * Update README.md Co-authored-by: Henry Schreiner --------- Co-authored-by: Henry Schreiner --- README.md | 2 ++ cibuildwheel/__main__.py | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 68977ad0..3b252eee 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ Python wheels are great. Building them across **Mac, Linux, Windows**, on **mult What does it do? ---------------- +While cibuildwheel itself requires a recent Python version to run (we support the last three releases), it can target the following versions to build wheels: + | | macOS Intel | macOS Apple Silicon | Windows 64bit | Windows 32bit | Windows Arm64 | manylinux
musllinux x86_64 | manylinux
musllinux i686 | manylinux
musllinux aarch64 | manylinux
musllinux ppc64le | manylinux
musllinux s390x | musllinux armv7l | Pyodide | |----------------|----|-----|-----|-----|-----|----|-----|----|-----|-----|---|-----| | CPython 3.6 | ✅ | N/A | ✅ | ✅ | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | N/A | diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 973c48a8..ffdde57b 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -380,14 +380,13 @@ def print_preamble(platform: str, options: Options, identifiers: Sequence[str]) print() print(f"Cache folder: {CIBW_CACHE_PATH}") + print() warnings = detect_warnings(options=options, identifiers=identifiers) - if warnings: - print("\nWarnings:") - for warning in warnings: - print(" " + warning) + for warning in warnings: + log.warning(warning) - print("\nHere we go!\n") + print("Here we go!\n") def get_build_identifiers( @@ -402,6 +401,16 @@ def get_build_identifiers( def detect_warnings(*, options: Options, identifiers: Iterable[str]) -> list[str]: warnings = [] + python_version_deprecation = ((3, 11), 3) + if sys.version_info[:2] < python_version_deprecation[0]: + python_version = ".".join(map(str, python_version_deprecation[0])) + msg = ( + f"cibuildwheel {python_version_deprecation[1]} will require Python {python_version}+, " + "please upgrade the Python version used to run cibuildwheel. " + "This does not affect the versions you can target when building wheels. See: https://cibuildwheel.pypa.io/en/stable/#what-does-it-do" + ) + warnings.append(msg) + # warn about deprecated {python} and {pip} for option_name in ["test_command", "before_build"]: option_values = [getattr(options.build_options(i), option_name) for i in identifiers] @@ -410,7 +419,7 @@ def detect_warnings(*, options: Options, identifiers: Iterable[str]) -> list[str # Reminder: in an f-string, double braces means literal single brace msg = ( f"{option_name}: '{{python}}' and '{{pip}}' are no longer needed, " - "and will be removed in a future release. Simply use 'python' or 'pip' instead." + "and will be removed in cibuildwheel 3. Simply use 'python' or 'pip' instead." ) warnings.append(msg)