I now have an MVP for a WASI distribution coded up at GitHub - brettcannon/cpython at wasi-package · GitHub . But before I go and ask for a code review, I wanted to make sure I wasn’t missing anything. Below is the output from wasi package which explains what files are included in the final archive (do note that output scrolls and symlinks are not listed):
🧹 Deleting /home/brett/Repositories/python/cpython/dist ...
📝 Copying files to /home/brett/Repositories/python/cpython/dist/python-3.16.0a0-wasm32-wasip1 ...
📁 bin/
📄 python3.16d-config
📄 python3.16d.wasmtime
📁 etc/
📁 python3.16/
📄 wasmtime.toml
📁 include/
📁 python3.16/
📄 pyconfig.h
📄 **/*.h
📁 lib/
📁 python3.16/
📁 lib-wasm
📄 python3.16d.wasm
📄 LICENSE.txt
📄 files in `cat pybuilddir.txt`
📄 **/*.py
📁 pkgconfig/
📄 python*.pc
📁 share/
📁 man/
📁 man1/
📄 python*.1
🗜️ Compressing to /home/brett/Repositories/python/cpython/dist/python-3.16.0a0-wasm32-wasip1.tar.xz ...
The most important things to notice are:
lib/python3.16/lib-wasm/python3.16d.wasmbin/python3.16d.wasmtimeetc/python3.16/wasmtime.toml
For python3.16d.wasm, I think that’s a reasonable place for the file.
As for python3.16d.wasmtime, it’s contents are:
#!/bin/sh
set -eu
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd -P)
root=$(CDPATH= cd "$script_dir/.." && pwd -P)
wasm_file="$root/lib/python3.16/lib-wasm/python3.16d.wasm"
exec wasmtime run \
--argv0 "$wasm_file" \
--config "$root/etc/python3.16/wasmtime.toml" \
--dir "/" \
"$wasm_file" "$@"
And for wasmtime.toml, I think that’s the right place for it (it’s just a copy of cpython/Platforms/WASI/wasmtime.toml at main · python/cpython · GitHub ).
Everything else is just copying files from the right place.