# 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 (bookmark where I/someone left off)
- 🛑 Blocked by something (stop and check status before proceeding)
# Plans
- [ ] 🥧 [[Support a new WASI SDK version]]: [WASI SDK 31](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-31)
1. [x] Open a [CPython issue](https://github.com/python/cpython/issues) ([issue](https://github.com/python/cpython/issues/145844))
2. [ ] **Draft** a [CPython PR](https://github.com/python/cpython/pulls) to update the version (⚠️ do **NOT** merge until the Buildbot is ready!; [PR](https://github.com/python/cpython/pull/145859))
3. [ ] Update the [WASI dev container](https://github.com/python/cpython-devcontainers/tree/main/wasicontainer)
4. [ ] Get the new SDK on the [[Buildbot]] worker
5. [ ] Merge the CPython PR
- [ ] 🛑 [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 (thanks to PEP 816, might be able to do just `wasi_wasm32` and non-standard `wasi_N_N_sdk_N_wasm32` in `packaging` when not matching PEP 11)
- [ ] 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
- `--without-static-libpython`
- 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`
- `python.wasm` renamed to `python3.NN.wasm`
- [X] [Refactor](https://github.com/brettcannon/cpython/tree/wasi-refactor) `Platforms/WASI` to support other subcommands ([PR](https://github.com/python/cpython/pull/145404))
- [ ] Implement
- [ ] Use the WASI dev container to [build and export the package](https://docs.docker.com/build/building/export/)
- [ ] Have the RM release the fbinaries
- [ ] [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]]