From bed7f8af495168ffc17bc9d16b5553179f95c184 Mon Sep 17 00:00:00 2001 From: adam j hartz Date: Fri, 1 Aug 2025 13:27:51 -0400 Subject: [PATCH 1/4] news blurb for removal of wasm_build.py --- .../Tools-Demos/2025-08-01-13-27-43.gh-issue-137025.ubuhQC.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Tools-Demos/2025-08-01-13-27-43.gh-issue-137025.ubuhQC.rst diff --git a/Misc/NEWS.d/next/Tools-Demos/2025-08-01-13-27-43.gh-issue-137025.ubuhQC.rst b/Misc/NEWS.d/next/Tools-Demos/2025-08-01-13-27-43.gh-issue-137025.ubuhQC.rst new file mode 100644 index 00000000000000..73c79564006526 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/2025-08-01-13-27-43.gh-issue-137025.ubuhQC.rst @@ -0,0 +1,3 @@ +The ``wasm_build.py`` script has been removed. ``Tools/wasm/emscripten`` +and ``Tools/wasm/wasi`` should be used instead, as described in the `Dev +Guide `__. From 05c12cef2bbcf47c48243cc2ea7005d186edf375 Mon Sep 17 00:00:00 2001 From: adam j hartz Date: Fri, 1 Aug 2025 13:42:21 -0400 Subject: [PATCH 2/4] reference dev guide for building emscripten --- Tools/wasm/README.md | 65 ++++++-------------------------------------- 1 file changed, 8 insertions(+), 57 deletions(-) diff --git a/Tools/wasm/README.md b/Tools/wasm/README.md index efe9a3550c3e19..1d7ad7bd9e76d7 100644 --- a/Tools/wasm/README.md +++ b/Tools/wasm/README.md @@ -9,68 +9,19 @@ compilation of CPython to WebAssembly (WASM). Python supports Emscripten run in modern browsers and JavaScript runtimes like *Node.js*. WASI builds use WASM runtimes such as *wasmtime*. -Users and developers are encouraged to use the script -`Tools/wasm/wasm_build.py`. The tool automates the build process and provides -assistance with installation of SDKs, running tests, etc. +Users and developers are encouraged to use the `Tools/wasm/emscripten` and +`Tools/wasm/wasi` for building CPython for WebAssembly. These tools automate +the build process and provide assistance with installation of SDKs, running +tests, etc. -**NOTE**: If you are looking for information that is not directly related to -building CPython for WebAssembly (or the resulting build), please see -https://github.com/psf/webassembly for more information. +**NOTE**: If you are looking for general information about WebAssembly that is +not directly related to CPython, please see https://github.com/psf/webassembly. -## wasm32-emscripten +## Emscripten (wasm32-emscripten) ### Build -To cross compile to the ``wasm32-emscripten`` platform you need -[the Emscripten compiler toolchain](https://emscripten.org/), -a Python interpreter, and an installation of Node version 18 or newer. -Emscripten version 4.0.2 is recommended; newer versions may also work, but all -official testing is performed with that version. All commands below are relative -to a checkout of the Python repository. - -#### Install [the Emscripten compiler toolchain](https://emscripten.org/docs/getting_started/downloads.html) - -You can install the Emscripten toolchain as follows: -```shell -git clone https://github.com/emscripten-core/emsdk.git --depth 1 -./emsdk/emsdk install latest -./emsdk/emsdk activate latest -``` -To add the Emscripten compiler to your path: -```shell -source ./emsdk/emsdk_env.sh -``` -This adds `emcc` and `emconfigure` to your path. - -##### Optionally: enable ccache for EMSDK - -The ``EM_COMPILER_WRAPPER`` must be set after the EMSDK environment is -sourced. Otherwise the source script removes the environment variable. - -```shell -export EM_COMPILER_WRAPPER=ccache -``` - -#### Compile and build Python interpreter - -You can use `python Tools/wasm/emscripten` to compile and build targeting -Emscripten. You can do everything at once with: -```shell -python Tools/wasm/emscripten build -``` -or you can break it out into four separate steps: -```shell -python Tools/wasm/emscripten configure-build-python -python Tools/wasm/emscripten make-build-python -python Tools/wasm/emscripten make-libffi -python Tools/wasm/emscripten configure-host -python Tools/wasm/emscripten make-host -``` -Extra arguments to the configure steps are passed along to configure. For -instance, to do a debug build, you can use: -```shell -python Tools/wasm/emscripten build --with-py-debug -``` +See [the devguide instructions for building for Emscripten](https://devguide.python.org/getting-started/setup-building/#emscripten). ### Running from node From 5f31272b71ea91a7ce266bbabb5efa8e3f6c9376 Mon Sep 17 00:00:00 2001 From: adam j hartz Date: Fri, 1 Aug 2025 13:52:35 -0400 Subject: [PATCH 3/4] small wording changes --- Tools/wasm/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tools/wasm/README.md b/Tools/wasm/README.md index 1d7ad7bd9e76d7..1bc6a1db410cf5 100644 --- a/Tools/wasm/README.md +++ b/Tools/wasm/README.md @@ -9,10 +9,10 @@ compilation of CPython to WebAssembly (WASM). Python supports Emscripten run in modern browsers and JavaScript runtimes like *Node.js*. WASI builds use WASM runtimes such as *wasmtime*. -Users and developers are encouraged to use the `Tools/wasm/emscripten` and -`Tools/wasm/wasi` for building CPython for WebAssembly. These tools automate -the build process and provide assistance with installation of SDKs, running -tests, etc. +Users and developers are encouraged to use `Tools/wasm/emscripten` and +`Tools/wasm/wasi` for building CPython for WebAssembly, as described below. +These tools automate the build process and provide assistance with installation +of SDKs, running tests, etc. **NOTE**: If you are looking for general information about WebAssembly that is not directly related to CPython, please see https://github.com/psf/webassembly. @@ -48,8 +48,8 @@ You can run the browser smoke test with: ### The Web Example -When building for Emscripten, the web example will be built automatically. It -is in the ``web_example`` directory. To run the web example, ``cd`` into the +When building for Emscripten, a small web example will be built automatically +in the ``web_example`` directory. To run the web example, ``cd`` into the ``web_example`` directory, then run ``python server.py``. This will start a web server; you can then visit ``http://localhost:8000/`` in a browser to see a simple REPL example. From 243fe710b75c090b69b605e8a390691a99d42c6a Mon Sep 17 00:00:00 2001 From: adam j hartz Date: Sat, 2 Aug 2025 18:11:09 -0400 Subject: [PATCH 4/4] remove unnecessary paragraph about build tools --- Tools/wasm/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Tools/wasm/README.md b/Tools/wasm/README.md index 1bc6a1db410cf5..6615f1e2664196 100644 --- a/Tools/wasm/README.md +++ b/Tools/wasm/README.md @@ -9,11 +9,6 @@ compilation of CPython to WebAssembly (WASM). Python supports Emscripten run in modern browsers and JavaScript runtimes like *Node.js*. WASI builds use WASM runtimes such as *wasmtime*. -Users and developers are encouraged to use `Tools/wasm/emscripten` and -`Tools/wasm/wasi` for building CPython for WebAssembly, as described below. -These tools automate the build process and provide assistance with installation -of SDKs, running tests, etc. - **NOTE**: If you are looking for general information about WebAssembly that is not directly related to CPython, please see https://github.com/psf/webassembly.