Skip to content

Commit 4aaa823

Browse files
joerickhenryiii
andauthored
feat: add pyodide 0.28 and pyodide-prerelease (#2431)
* Add pyodide 0.28.0a3 * Add docs and tests for 0.28 This reverts commit 2e7d716. * fix: add selector for pyodide-prerelease, and add graalpy to schema Signed-off-by: Henry Schreiner <[email protected]> --------- Signed-off-by: Henry Schreiner <[email protected]> Co-authored-by: Henry Schreiner <[email protected]>
1 parent e6b4e2d commit 4aaa823

File tree

9 files changed

+52
-12
lines changed

9 files changed

+52
-12
lines changed

bin/generate_schema.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@
3333
description: How to inherit the parent's value.
3434
enable:
3535
enum:
36+
- cpython-experimental-riscv64
3637
- cpython-freethreading
3738
- cpython-prerelease
39+
- graalpy
40+
- pyodide-prerelease
3841
- pypy
3942
- pypy-eol
40-
- cpython-experimental-riscv64
4143
description: A Python version or flavor to enable.
4244
additionalProperties: false
4345
description: cibuildwheel's settings.

cibuildwheel/resources/build-platforms.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ python_configurations = [
221221
[pyodide]
222222
python_configurations = [
223223
{ identifier = "cp312-pyodide_wasm32", version = "3.12", default_pyodide_version = "0.27.6", node_version = "v22" },
224+
{ identifier = "cp313-pyodide_wasm32", version = "3.13", default_pyodide_version = "0.28.0a3", node_version = "v22" },
224225
]
225226

226227
[ios]

cibuildwheel/resources/cibuildwheel.schema.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
},
1414
"enable": {
1515
"enum": [
16+
"cpython-experimental-riscv64",
1617
"cpython-freethreading",
1718
"cpython-prerelease",
19+
"graalpy",
20+
"pyodide-prerelease",
1821
"pypy",
19-
"pypy-eol",
20-
"cpython-experimental-riscv64"
22+
"pypy-eol"
2123
]
2224
},
2325
"description": "A Python version or flavor to enable."

cibuildwheel/selector.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ class EnableGroup(StrEnum):
2929
Groups of build selectors that are not enabled by default.
3030
"""
3131

32+
CPythonExperimentalRiscV64 = "cpython-experimental-riscv64"
3233
CPythonFreeThreading = "cpython-freethreading"
3334
CPythonPrerelease = "cpython-prerelease"
35+
GraalPy = "graalpy"
3436
PyPy = "pypy"
3537
PyPyEoL = "pypy-eol"
36-
CPythonExperimentalRiscV64 = "cpython-experimental-riscv64"
37-
GraalPy = "graalpy"
38+
PyodidePrerelease = "pyodide-prerelease"
3839

3940
@classmethod
4041
def all_groups(cls) -> frozenset["EnableGroup"]:
@@ -98,6 +99,10 @@ def __call__(self, build_id: str) -> bool:
9899
return False
99100
if EnableGroup.GraalPy not in self.enable and fnmatch(build_id, "gp*"):
100101
return False
102+
if EnableGroup.PyodidePrerelease not in self.enable and fnmatch(
103+
build_id, "cp313-pyodide_*"
104+
):
105+
return False
101106

102107
should_build = selector_matches(self.build_config, build_id)
103108
should_skip = selector_matches(self.skip_config, build_id)

docs/options.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ When setting the options, you can use shell-style globbing syntax, as per [fnmat
5858
| Python 3.10 | cp310-macosx_x86_64<br/>cp310-macosx_universal2<br/>cp310-macosx_arm64 | cp310-win_amd64<br/>cp310-win32<br/>cp310-win_arm64 | cp310-manylinux_x86_64<br/>cp310-manylinux_i686<br/>cp310-musllinux_x86_64<br/>cp310-musllinux_i686 | cp310-manylinux_aarch64<br/>cp310-manylinux_ppc64le<br/>cp310-manylinux_s390x<br/>cp310-manylinux_armv7l<br/>cp310-manylinux_riscv64<br/>cp310-musllinux_aarch64<br/>cp310-musllinux_ppc64le<br/>cp310-musllinux_s390x<br/>cp310-musllinux_armv7l<br/>cp310-musllinux_riscv64 | | |
5959
| Python 3.11 | cp311-macosx_x86_64<br/>cp311-macosx_universal2<br/>cp311-macosx_arm64 | cp311-win_amd64<br/>cp311-win32<br/>cp311-win_arm64 | cp311-manylinux_x86_64<br/>cp311-manylinux_i686<br/>cp311-musllinux_x86_64<br/>cp311-musllinux_i686 | cp311-manylinux_aarch64<br/>cp311-manylinux_ppc64le<br/>cp311-manylinux_s390x<br/>cp311-manylinux_armv7l<br/>cp311-manylinux_riscv64<br/>cp311-musllinux_aarch64<br/>cp311-musllinux_ppc64le<br/>cp311-musllinux_s390x<br/>cp311-musllinux_armv7l<br/>cp311-musllinux_riscv64 | | |
6060
| Python 3.12 | cp312-macosx_x86_64<br/>cp312-macosx_universal2<br/>cp312-macosx_arm64 | cp312-win_amd64<br/>cp312-win32<br/>cp312-win_arm64 | cp312-manylinux_x86_64<br/>cp312-manylinux_i686<br/>cp312-musllinux_x86_64<br/>cp312-musllinux_i686 | cp312-manylinux_aarch64<br/>cp312-manylinux_ppc64le<br/>cp312-manylinux_s390x<br/>cp312-manylinux_armv7l<br/>cp312-manylinux_riscv64<br/>cp312-musllinux_aarch64<br/>cp312-musllinux_ppc64le<br/>cp312-musllinux_s390x<br/>cp312-musllinux_armv7l<br/>cp312-musllinux_riscv64 | | cp312-pyodide_wasm32 |
61-
| Python 3.13 | cp313-macosx_x86_64<br/>cp313-macosx_universal2<br/>cp313-macosx_arm64 | cp313-win_amd64<br/>cp313-win32<br/>cp313-win_arm64 | cp313-manylinux_x86_64<br/>cp313-manylinux_i686<br/>cp313-musllinux_x86_64<br/>cp313-musllinux_i686 | cp313-manylinux_aarch64<br/>cp313-manylinux_ppc64le<br/>cp313-manylinux_s390x<br/>cp313-manylinux_armv7l<br/>cp313-manylinux_riscv64<br/>cp313-musllinux_aarch64<br/>cp313-musllinux_ppc64le<br/>cp313-musllinux_s390x<br/>cp313-musllinux_armv7l<br/>cp313-musllinux_riscv64 | cp313-ios_arm64_iphoneos<br/>cp313-ios_arm64_iphonesimulator<br/>cp313-ios_x86_64_iphonesimulator | |
61+
| Python 3.13 | cp313-macosx_x86_64<br/>cp313-macosx_universal2<br/>cp313-macosx_arm64 | cp313-win_amd64<br/>cp313-win32<br/>cp313-win_arm64 | cp313-manylinux_x86_64<br/>cp313-manylinux_i686<br/>cp313-musllinux_x86_64<br/>cp313-musllinux_i686 | cp313-manylinux_aarch64<br/>cp313-manylinux_ppc64le<br/>cp313-manylinux_s390x<br/>cp313-manylinux_armv7l<br/>cp313-manylinux_riscv64<br/>cp313-musllinux_aarch64<br/>cp313-musllinux_ppc64le<br/>cp313-musllinux_s390x<br/>cp313-musllinux_armv7l<br/>cp313-musllinux_riscv64 | cp313-ios_arm64_iphoneos<br/>cp313-ios_arm64_iphonesimulator<br/>cp313-ios_x86_64_iphonesimulator | cp313-pyodide_wasm32 |
6262
| Python 3.14 | cp314-macosx_x86_64<br/>cp314-macosx_universal2<br/>cp314-macosx_arm64 | cp314-win_amd64<br/>cp314-win32<br/>cp314-win_arm64 | cp314-manylinux_x86_64<br/>cp314-manylinux_i686<br/>cp314-musllinux_x86_64<br/>cp314-musllinux_i686 | cp314-manylinux_aarch64<br/>cp314-manylinux_ppc64le<br/>cp314-manylinux_s390x<br/>cp314-manylinux_armv7l<br/>cp314-manylinux_riscv64<br/>cp314-musllinux_aarch64<br/>cp314-musllinux_ppc64le<br/>cp314-musllinux_s390x<br/>cp314-musllinux_armv7l<br/>cp314-musllinux_riscv64 | | |
6363
| PyPy3.8 v7.3 | pp38-macosx_x86_64<br/>pp38-macosx_arm64 | pp38-win_amd64 | pp38-manylinux_x86_64<br/>pp38-manylinux_i686 | pp38-manylinux_aarch64 | | |
6464
| PyPy3.9 v7.3 | pp39-macosx_x86_64<br/>pp39-macosx_arm64 | pp39-win_amd64 | pp39-manylinux_x86_64<br/>pp39-manylinux_i686 | pp39-manylinux_aarch64 | | |
@@ -334,15 +334,18 @@ values are:
334334
are disabled by default as they can't be uploaded to PyPI and a PEP will most likely
335335
be required before this can happen.
336336
- `graalpy`: Enable GraalPy.
337+
- `pyodide-prerelease`: Pyodide versions that haven't released yet, if one is
338+
available. Safe if you are shipping a site with an early build, not for
339+
general distribution.
337340
- `all`: Enable all of the above.
338341

339342
!!! caution
340343
`cpython-prerelease` is provided for testing purposes only. It is not
341344
recommended to distribute wheels built with beta releases, such as
342-
uploading to PyPI. Please _do not_ upload these wheels to PyPI, as they are
343-
not guaranteed to work with the final Python release. Once Python is ABI
344-
stable and enters the release candidate phase, that version of Python will
345-
become available without this flag.
345+
uploading to PyPI. Please _do not_ upload these wheels to PyPI (except for
346+
pre-releases), as they are not guaranteed to work with the final Python
347+
release. Once Python is ABI stable and enters the release candidate phase,
348+
that version of Python will become available without this flag.
346349

347350
!!! note
348351
Free threading is experimental: [What’s New In Python 3.13](https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython)

docs/platforms.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ You must target pyodide with `--platform pyodide` (or use `--only` on the identi
170170

171171
### Choosing a Pyodide version {: #pyodide-choosing-a-version}
172172

173-
It is also possible to target a specific Pyodide version by setting the `pyodide-version` option to the desired version. Users are responsible for setting an appropriate Pyodide version according to the `pyodide-build` version. A list is available in Pyodide's [cross-build environments metadata file](https://github.com/pyodide/pyodide/blob/main/pyodide-cross-build-environments.json), which can be viewed more easily by installing `pyodide-build` from PyPI and using `pyodide xbuildenv search --all` to see a compatibility table.
173+
It is also possible to target a specific Pyodide version by setting the [`pyodide-version`](options.md#pyodide-version) option to the desired version. Users are responsible for setting an appropriate Pyodide version according to the `pyodide-build` version. A list is available in Pyodide's [cross-build environments metadata file](https://github.com/pyodide/pyodide/blob/main/pyodide-cross-build-environments.json), which can be viewed more easily by installing `pyodide-build` from PyPI and using `pyodide xbuildenv search --all` to see a compatibility table.
174+
175+
If there are pre-releases available for a newer Python version, the `pyodide-prerelease` [`enable`](options.md#enable) can be used to include pre-release versions.
174176

175177
### Running tests
176178

test/test_pyodide.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_pyodide_build(tmp_path, use_pyproject_toml):
5858
basic_project.generate(project_dir)
5959

6060
# check for node in 1 case only to reduce CI load
61-
add_env = {}
61+
add_env = {"CIBW_ENABLE": "pyodide-prerelease"}
6262
if use_pyproject_toml:
6363
add_env["CIBW_TEST_COMMAND"] = f"python {{project}}/check_node.py {CIBW_CACHE_PATH}"
6464

@@ -72,6 +72,7 @@ def test_pyodide_build(tmp_path, use_pyproject_toml):
7272
# check that the expected wheels are produced
7373
expected_wheels = [
7474
"spam-0.1.0-cp312-cp312-pyodide_2024_0_wasm32.whl",
75+
"spam-0.1.0-cp313-cp313-pyodide_2025_0_wasm32.whl",
7576
]
7677

7778
print("actual_wheels", actual_wheels)
@@ -130,11 +131,13 @@ def test_filter():
130131
add_env={
131132
"CIBW_TEST_REQUIRES": "pytest",
132133
"CIBW_TEST_COMMAND": "python -m pytest {project}",
134+
"CIBW_ENABLE": "pyodide-prerelease",
133135
},
134136
)
135137
# check that the expected wheels are produced
136138
expected_wheels = [
137139
"spam-0.1.0-cp312-cp312-pyodide_2024_0_wasm32.whl",
140+
"spam-0.1.0-cp313-cp313-pyodide_2025_0_wasm32.whl",
138141
]
139142
print("actual_wheels", actual_wheels)
140143
print("expected_wheels", expected_wheels)

test/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ def _expected_wheels(
261261

262262
if platform == "pyodide" and python_abi_tags is None:
263263
python_abi_tags = ["cp312-cp312"]
264+
if EnableGroup.PyodidePrerelease in enable_groups:
265+
python_abi_tags.append("cp313-cp313")
264266
elif platform == "ios" and python_abi_tags is None:
265267
python_abi_tags = ["cp313-cp313"]
266268
elif python_abi_tags is None:

unit_test/build_selector_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,26 @@ def test_build_filter_pypy_all():
8989
assert build_selector("pp39-manylinux_x86_64")
9090

9191

92+
def test_build_filter_pyodide_prerelease():
93+
build_selector = BuildSelector(
94+
build_config="*",
95+
skip_config="",
96+
enable=frozenset([EnableGroup.PyodidePrerelease]),
97+
)
98+
assert build_selector("cp312-pyodide_wasm32")
99+
assert build_selector("cp313-pyodide_wasm32")
100+
101+
102+
def test_build_filter_pyodide():
103+
build_selector = BuildSelector(
104+
build_config="*",
105+
skip_config="",
106+
enable=frozenset(),
107+
)
108+
assert build_selector("cp312-pyodide_wasm32")
109+
assert not build_selector("cp313-pyodide_wasm32")
110+
111+
92112
def test_skip():
93113
build_selector = BuildSelector(
94114
build_config="*",

0 commit comments

Comments
 (0)