# Important links
- [`os-wasi` label](https://github.com/python/cpython/labels/OS-wasi)
- [WASI dev container definition](https://github.com/python/cpython-devcontainers/tree/main/wasicontainer) ([image](https://github.com/python/cpython-devcontainers/pkgs/container/wasicontainer))
# Legend
- 🥧 beginner-friendly ("as easy as pie")
- 🔖 Working on it
- 🛑 Blocked by something
# Plans
- [ ] 🛑 Use [WASI SDK action](https://github.com/bytecodealliance/setup-wasi-sdk-action) ([issue](https://github.com/bytecodealliance/setup-wasi-sdk-action/issues/14); [PR](https://github.com/bytecodealliance/setup-wasi-sdk-action/pull/15))
- [ ] CPython
- [ ] cpython-wasi-build
- [ ] 🥧 [Simplify finding `_sysconfigdata`](https://github.com/python/cpython/issues/144533)
- [ ] PEP to specify WASI SDK compatibility expectations
- [x] Have `wasi/` check for `wasi-sdk/VERSION` -- [25 and later](https://github.com/WebAssembly/wasi-sdk/issues/471) -- when using `/opt/wasi-sdk` and warn when it doesn't match the expected version ([PR](https://github.com/python/cpython/pull/140769))
- [x] Use `/opt/wasi-sdk-NN` automatically based on what the appropriate version is ([PR](https://github.com/python/cpython/pull/137244)) ^wasi-sdk-NN
- [x] Update [[#^wasi-container]] to ship with all relevant WASI SDK versions
- [x] Write [PEP](https://github.com/brettcannon/peps/blob/wasi-support-pep/peps/pep-NNNN.rst)
- [x] Make sure [Bytecode Alliance folks think it's reasonable](https://bytecodealliance.zulipchat.com/#narrow/channel/394175-SIG-Guest-Languages/topic/Python.20Enhancement.20Proposals.20.28PEPs.29.20for.20WASI/near/554182568)
- [x] Make sure key core devs think it's reasonable
- [x] See if the [SC would rather](https://github.com/python/steering-council/issues/319) I just keep the details in PEP 11
- [x] Merge [PR](https://github.com/python/peps/pull/4732)
- [x] [Post](https://discuss.python.org/t/pep-816-wasi-support/105237)
- [ ] 🛑 SC approval ([request](https://github.com/python/steering-council/issues/329))
- [ ] 🛑 [Support `wasm32-wasip3`](https://github.com/python/cpython/issues/121634) (skipping p2; blocked on WASI 0.3 being released)
- [x] Ability to specify host triple
- [x] Find out if `wasip2` is compatible w/ preview1 hosts
- [ ] buildbot
- [ ] PEP 11
- [ ] PEP for a wheel tag ([discussion](https://bytecodealliance.zulipchat.com/#narrow/channel/219900-wasi/topic/Platform.20tags.20for.20packages.20targeting.20WASI/with/516694780))
- [ ] Expose WASI details in `sys` or `platform` ([changes in wasi-libc](https://github.com/WebAssembly/wasi-libc/issues/688))
- [ ] Draft PEP
- [ ] Post to DPO
- [ ] Submit for approval
- [ ] `wasi package`
- [x] Figure out file name (`python-3.25.0a3-wasm32-wasip1.tar.xz`; host triple from `config.toml`; [`platform.python_version()`](https://docs.python.org/3/library/platform.html#platform.python_version))
- [x] Research what should be shipped for building extensions
- Top-level stuff in `cross-build/wasm32-wasip1` accounted for (e.g. [`pyconfig.h`](https://github.com/python/cpython/blob/957f9fe162398fceeaa9ddba8b40046b8a03176d/Makefile.pre.in#L2964))
- [`build/lib.*` to the stdlib (sans `__pycache__`)](https://github.com/python/cpython/blob/957f9fe162398fceeaa9ddba8b40046b8a03176d/Makefile.pre.in#L2853-L2855)
- [`LICENSE` to `LICENSE.txt`](https://github.com/python/cpython/blob/957f9fe162398fceeaa9ddba8b40046b8a03176d/Makefile.pre.in#L2856)
- `include/pythonN.Nd` if debug, otherwise `lib/pythonN.N`
- [ ] See if [exporting binaries](https://docs.docker.com/build/building/export/) from the WASI container is possible
- [ ] Release binaries
- [ ] [External dependencies](https://github.com/python/cpython-source-deps) via `wasi externals`
- [ ] Figure out what version policy we want (i.e. always latest or freeze versions like Windows builds? If latter, make it an external config)
- [ ] [zlib](https://github.com/python/cpython/issues/91246) (and potentially undoing part of https://github.com/python/cpython/pull/130297)/zlib-ng
- `RANLIB=/opt/wasi-sdk-29.0-x86_64-linux/bin/ranlib CC=/opt/wasi-sdk-29.0-x86_64-linux/bin/clang CHOST=wasm32 ./configure --static --zlib-compat --prefix ... && make install`
- Blank out `PKG_CONFIG_SYSROOT_DIR` and `PKG_CONFIG_PATH`, set `PKG_CONFIG_LIBDIR` to where `lib/pkgconfig` ended up from `--prefix`
- [ ] bzip2
- [ ] xz
- [`get_externals.bat`](https://github.com/python/cpython/blob/5592399313c963c110280a7c98de974889e1d353/PCbuild/get_externals.bat#L61)
- [`python.props`](https://github.com/python/cpython/blob/5592399313c963c110280a7c98de974889e1d353/PCbuild/python.props#L73)
- [`externals.spdx.json`](https://github.com/python/cpython/blob/5592399313c963c110280a7c98de974889e1d353/Misc/externals.spdx.json#L160)
- [ ] sqlite
- [ ] zstd
- [ ] mpdecimal
- [x] OpenSSL (not safe as WebAssembly doesn't have constant time ops)
- [ ] 🛑 Networking under WASI 0.3 (blocked on threading in WASI 0.3 being released)
- [Joel's hack](https://github.com/dicej/cpython/commit/118e9d8eeabb6345d57295f6cec1616694eacbc2)
- Any tests requiring threads probably won't work
- See the [headers in wasi-libc](https://github.com/WebAssembly/wasi-libc/tree/main/libc-top-half/musl/include) for what can be turned on
- Will probably require tweaking `config.site`
- [ ] 🥧 Make sure build details are still relevant
- [ ] Check if all the flags set in `configure.ac` are necessary
- [ ] Check what `__wasi__` usage can be removed
- [x] [Check](https://github.com/python/cpython/issues/115982) that the [site config](https://github.com/python/cpython/blob/main/Tools/wasm/config.site-wasm32-wasi) is up-to-date
- [ ] [[HTTP fetch API]]