Skip to content

Commit 7c3b0fb

Browse files
mayeuthenryiii
andauthored
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 <[email protected]> --------- Co-authored-by: Henry Schreiner <[email protected]>
1 parent b986027 commit 7c3b0fb

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Python wheels are great. Building them across **Mac, Linux, Windows**, on **mult
2222
What does it do?
2323
----------------
2424

25+
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:
26+
2527
| | macOS Intel | macOS Apple Silicon | Windows 64bit | Windows 32bit | Windows Arm64 | manylinux<br/>musllinux x86_64 | manylinux<br/>musllinux i686 | manylinux<br/>musllinux aarch64 | manylinux<br/>musllinux ppc64le | manylinux<br/>musllinux s390x | musllinux armv7l | Pyodide |
2628
|----------------|----|-----|-----|-----|-----|----|-----|----|-----|-----|---|-----|
2729
| CPython 3.6 || N/A ||| N/A ||||||| N/A |

cibuildwheel/__main__.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,13 @@ def print_preamble(platform: str, options: Options, identifiers: Sequence[str])
380380

381381
print()
382382
print(f"Cache folder: {CIBW_CACHE_PATH}")
383+
print()
383384

384385
warnings = detect_warnings(options=options, identifiers=identifiers)
385-
if warnings:
386-
print("\nWarnings:")
387-
for warning in warnings:
388-
print(" " + warning)
386+
for warning in warnings:
387+
log.warning(warning)
389388

390-
print("\nHere we go!\n")
389+
print("Here we go!\n")
391390

392391

393392
def get_build_identifiers(
@@ -402,6 +401,16 @@ def get_build_identifiers(
402401
def detect_warnings(*, options: Options, identifiers: Iterable[str]) -> list[str]:
403402
warnings = []
404403

404+
python_version_deprecation = ((3, 11), 3)
405+
if sys.version_info[:2] < python_version_deprecation[0]:
406+
python_version = ".".join(map(str, python_version_deprecation[0]))
407+
msg = (
408+
f"cibuildwheel {python_version_deprecation[1]} will require Python {python_version}+, "
409+
"please upgrade the Python version used to run cibuildwheel. "
410+
"This does not affect the versions you can target when building wheels. See: https://cibuildwheel.pypa.io/en/stable/#what-does-it-do"
411+
)
412+
warnings.append(msg)
413+
405414
# warn about deprecated {python} and {pip}
406415
for option_name in ["test_command", "before_build"]:
407416
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
410419
# Reminder: in an f-string, double braces means literal single brace
411420
msg = (
412421
f"{option_name}: '{{python}}' and '{{pip}}' are no longer needed, "
413-
"and will be removed in a future release. Simply use 'python' or 'pip' instead."
422+
"and will be removed in cibuildwheel 3. Simply use 'python' or 'pip' instead."
414423
)
415424
warnings.append(msg)
416425

0 commit comments

Comments
 (0)