Skip to content

Commit 109020e

Browse files
Updates for Pyodide builds after pyodide-build was unvendored (#2090)
* Fix typos and capitalise * Add docstring for `install_xbuildenv` function * Include Emscripten, Pyodide version in logger messages * Mark separation of pyodide-build and Pyodide * Bump to Pyodide 0.26.4 (py3.12.7) + pyodide-build 0.29.0 * Use pyodide-build version as the source of truth * Update Pyodide constraints * Use 3.12 as the Python version instead of 3.12.7 Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com> * chore: appease the formatter --------- Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
1 parent fd99000 commit 109020e

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171
run: uv run pytest --run-emulation ${{ matrix.arch }} test/test_emulation.py
172172

173173
test-pyodide:
174-
name: Test cibuildwheel building pyodide wheels
174+
name: Test cibuildwheel building Pyodide wheels
175175
needs: lint
176176
runs-on: ubuntu-24.04
177177
timeout-minutes: 180

cibuildwheel/pyodide.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class PythonConfiguration:
4141
version: str
4242
identifier: str
4343
pyodide_version: str
44+
pyodide_build_version: str
4445
emscripten_version: str
4546
node_version: str
4647

@@ -65,10 +66,15 @@ def install_emscripten(tmp: Path, version: str) -> Path:
6566
return emcc_path
6667

6768

68-
def install_xbuildenv(env: dict[str, str], pyodide_version: str) -> str:
69+
def install_xbuildenv(env: dict[str, str], pyodide_build_version: str, pyodide_version: str) -> str:
70+
"""Install a particular Pyodide xbuildenv version and set a path to the Pyodide root."""
71+
# Since pyodide-build was unvendored from Pyodide v0.27.0, the versions of pyodide-build are
72+
# not guaranteed to match the versions of Pyodide or be in sync with them. Hence, we shall
73+
# specify the pyodide-build version in the root path, which will set up the xbuildenv for
74+
# the requested Pyodide version.
6975
pyodide_root = (
7076
CIBW_CACHE_PATH
71-
/ f".pyodide-xbuildenv-{pyodide_version}/{pyodide_version}/xbuildenv/pyodide-root"
77+
/ f".pyodide-xbuildenv-{pyodide_build_version}/{pyodide_version}/xbuildenv/pyodide-root"
7278
)
7379
with FileLock(CIBW_CACHE_PATH / "xbuildenv.lock"):
7480
if pyodide_root.exists():
@@ -165,13 +171,15 @@ def setup_python(
165171
env=env,
166172
)
167173

168-
log.step("Installing emscripten...")
174+
log.step(f"Installing Emscripten version: {python_configuration.emscripten_version} ...")
169175
emcc_path = install_emscripten(tmp, python_configuration.emscripten_version)
170176

171177
env["PATH"] = os.pathsep.join([str(emcc_path.parent), env["PATH"]])
172178

173-
log.step("Installing Pyodide xbuildenv...")
174-
env["PYODIDE_ROOT"] = install_xbuildenv(env, python_configuration.pyodide_version)
179+
log.step(f"Installing Pyodide xbuildenv version: {python_configuration.pyodide_version} ...")
180+
env["PYODIDE_ROOT"] = install_xbuildenv(
181+
env, python_configuration.pyodide_build_version, python_configuration.pyodide_version
182+
)
175183

176184
return env
177185

cibuildwheel/resources/build-platforms.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,5 @@ python_configurations = [
190190

191191
[pyodide]
192192
python_configurations = [
193-
{ identifier = "cp312-pyodide_wasm32", version = "3.12.1", pyodide_version = "0.26.1", emscripten_version = "3.1.58", node_version = "v20" },
193+
{ identifier = "cp312-pyodide_wasm32", version = "3.12", pyodide_version = "0.26.4", pyodide_build_version = "0.29.0", emscripten_version = "3.1.58", node_version = "v20" },
194194
]

cibuildwheel/resources/constraints-pyodide312.txt

+6-16
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ charset-normalizer==3.4.0
1919
# via requests
2020
click==8.1.7
2121
# via typer
22-
cloudpickle==3.1.0
23-
# via loky
2422
cmake==3.31.0.1
2523
# via pyodide-build
2624
distlib==0.3.9
@@ -40,8 +38,6 @@ idna==3.10
4038
# requests
4139
leb128==1.0.8
4240
# via auditwheel-emscripten
43-
loky==3.4.1
44-
# via pyodide-build
4541
markdown-it-py==3.0.0
4642
# via rich
4743
mdurl==0.1.2
@@ -56,26 +52,24 @@ pip==24.3.1
5652
# via -r .nox/update_constraints/tmp/constraints-pyodide.in
5753
platformdirs==4.3.6
5854
# via virtualenv
59-
pydantic==2.9.2
55+
pydantic==2.10.0
6056
# via
6157
# pyodide-build
6258
# pyodide-lock
63-
pydantic-core==2.23.4
59+
pydantic-core==2.27.0
6460
# via pydantic
6561
pygments==2.18.0
6662
# via rich
67-
pyodide-build==0.26.1
63+
pyodide-build==0.29.0
6864
# via -r .nox/update_constraints/tmp/constraints-pyodide.in
6965
pyodide-cli==0.2.4
7066
# via
7167
# auditwheel-emscripten
7268
# pyodide-build
73-
pyodide-lock==0.1.0a6
69+
pyodide-lock==0.1.0a7
7470
# via pyodide-build
7571
pyproject-hooks==1.2.0
7672
# via build
77-
pyyaml==6.0.2
78-
# via pyodide-build
7973
requests==2.32.3
8074
# via pyodide-build
8175
resolvelib==1.1.0
@@ -95,13 +89,11 @@ sniffio==1.3.1
9589
# via
9690
# anyio
9791
# httpx
98-
typer==0.13.0
92+
typer==0.13.1
9993
# via
10094
# auditwheel-emscripten
10195
# pyodide-build
10296
# pyodide-cli
103-
types-requests==2.32.0.20241016
104-
# via pyodide-build
10597
typing-extensions==4.12.2
10698
# via
10799
# pydantic
@@ -110,9 +102,7 @@ typing-extensions==4.12.2
110102
unearth==0.17.2
111103
# via pyodide-build
112104
urllib3==2.2.3
113-
# via
114-
# requests
115-
# types-requests
105+
# via requests
116106
virtualenv==20.27.1
117107
# via
118108
# build

noxfile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ def update_constraints(session: nox.Session) -> None:
106106
pyodides = build_platforms["pyodide"]["python_configurations"]
107107
for pyodide in pyodides:
108108
python_version = ".".join(pyodide["version"].split(".")[:2])
109-
pyodide_version = pyodide["pyodide_version"]
109+
pyodide_build_version = pyodide["pyodide_build_version"]
110110
output_file = resources / f"constraints-pyodide{python_version.replace('.', '')}.txt"
111111
tmp_file = Path(session.create_tmp()) / "constraints-pyodide.in"
112-
tmp_file.write_text(f"pip\nbuild[virtualenv]\npyodide-build=={pyodide_version}")
112+
tmp_file.write_text(f"pip\nbuild[virtualenv]\npyodide-build=={pyodide_build_version}")
113113
session.run(
114114
"uv",
115115
"pip",

test/test_emscripten.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
def check_node():
2222
# cibuildwheel adds a pinned node version to the PATH
23-
# check it's in the PATH then, check it's the one that runs pyoodide
23+
# check it's in the PATH then, check it's the one that runs Pyodide
2424
cibw_cache_path = Path(sys.argv[1]).resolve(strict=True)
2525
# find the node executable in PATH
2626
node = shutil.which("node")

0 commit comments

Comments
 (0)