pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/bc708c76d2b3ad7bbfd6577a4444e1e47db60fd6

458caf1e80bb.css" /> GH-116314: Update `Tools/wasm/README.md` to point to the devguide for… · python/cpython@bc708c7 · GitHub
Skip to content

Commit bc708c7

Browse files
authored
GH-116314: Update Tools/wasm/README.md to point to the devguide for building for WASI (GH-116445)
1 parent 2d4955f commit bc708c7

File tree

1 file changed

+3
-61
lines changed

1 file changed

+3
-61
lines changed

Tools/wasm/README.md

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Python WebAssembly (WASM) build
22

3-
**WARNING: WASM support is work-in-progress! Lots of features are not working yet.**
3+
**WASI support is [tier 2](https://peps.python.org/pep-0011/#tier-2).**
4+
**Emscripten is NOT officially supported as of Python 3.13.**
45

56
This directory contains configuration and helpers to facilitate cross
67
compilation of CPython to WebAssembly (WASM). Python supports Emscripten
@@ -298,66 +299,7 @@ AddType application/wasm wasm
298299

299300
## WASI (wasm32-wasi)
300301

301-
**NOTE**: The instructions below assume a Unix-based OS due to cross-compilation for CPython being set up for `./configure`.
302-
303-
### Prerequisites
304-
305-
Developing for WASI requires two additional tools to be installed beyond the typical tools required to build CPython:
306-
307-
1. The [WASI SDK](https://github.com/WebAssembly/wasi-sdk) 16.0+
308-
2. A WASI host/runtime ([wasmtime](https://wasmtime.dev) 14+ is recommended and what the instructions below assume)
309-
310-
All of this is provided in the [devcontainer](https://devguide.python.org/getting-started/setup-building/#contribute-using-github-codespaces) if you don't want to install these tools locally.
311-
312-
### Building
313-
314-
Building for WASI requires doing a cross-build where you have a "build" Python to help produce a WASI build of CPython (technically it's a "host x host" cross-build because the build Python is also the target Python while the host build is the WASI build; yes, it's confusing terminology). In the end you should have a build Python in `cross-build/build` and a WASI build in `cross-build/wasm32-wasi`.
315-
316-
The easiest way to do a build is to use the `wasi.py` script. You can either have it perform the entire build process from start to finish in one step, or you can do it in discrete steps that mirror running `configure` and `make` for each of the two builds of Python you end up producing (which are beneficial when you only need to do a specific step after getting a complete build, e.g. editing some code and you just need to run `make` for the WASI build). The script is designed to self-document what actions it is performing on your behalf, both as a way to check its work but also for educaitonal purposes.
317-
318-
The discrete steps for building via `wasi.py` are:
319-
```shell
320-
python Tools/wasm/wasi.py configure-build-python
321-
python Tools/wasm/wasi.py make-build-python
322-
python Tools/wasm/wasi.py configure-host
323-
python Tools/wasm/wasi.py make-host
324-
```
325-
326-
To do it all in a single command, run:
327-
```shell
328-
python Tools/wasm/wasi.py build
329-
```
330-
331-
That will:
332-
333-
1. Run `configure` for the build Python (same as `wasi.py configure-build-python`)
334-
2. Run `make` for the build Python (`wasi.py make-build-python`)
335-
3. Run `configure` for the WASI build (`wasi.py configure-host`)
336-
4. Run `make` for the WASI build (`wasi.py make-host`)
337-
338-
See the `--help` for the various options available for each of the subcommands which controls things like the location of the WASI SDK, the command to use with the WASI host/runtime, etc. Also note that you can use `--` as a separator for any of the `configure`-related commands -- including `build` itself -- to pass arguments to the underlying `configure` call. For example, if you want a pydebug build that also caches the results from `configure`, you can do:
339-
```shell
340-
python Tools/wasm/wasi.py build -- -C --with-pydebug
341-
```
342-
343-
The `wasi.py` script is able to infer details from the build Python, and so you only technically need to specify `--with-pydebug` once via `configure-build-python` as this will lead to `configure-host` detecting its use if you use the discrete steps:
344-
```shell
345-
python Tools/wasm/wasi.py configure-build-python -- -C --with-pydebug
346-
python Tools/wasm/wasi.py make-build-python
347-
python Tools/wasm/wasi.py configure-host -- -C
348-
python Tools/wasm/wasi.py make-host
349-
```
350-
351-
352-
### Running
353-
354-
If you used `wasi.py` to do your build then there will be a `cross-build/wasm32-wasi/python.sh` file which you can use to run the `python.wasm` file (see the output from the `configure-host` subcommand):
355-
```shell
356-
cross-build/wasm32-wasi/python.sh --version
357-
```
358-
359-
While you _can_ run `python.wasm` directly, Python will fail to start up without certain things being set (e.g. `PYTHONPATH` for `sysconfig` data). As such, the `python.sh` file records these details for you.
360-
302+
See [the devguide on how to build and run for WASI](https://devguide.python.org/getting-started/setup-building/#wasi).
361303

362304
## Detecting WebAssembly builds
363305

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy