singlestore-labs / python-wasi

Utilities for building CPython for the WASI platform
Apache License 2.0
96 stars 14 forks source link

Link with `libwasi_vfs.a` #6

Closed rjzak closed 1 year ago

rjzak commented 2 years ago

Linking with libwasi_vfs.a allows for a Wasm file to be created where the Python library scripts can be packed into the Wasm itself, along with custom Python scripts a user wishes to run. This would allow for a portable, self-contained Python Wasm file. This is already done for Ruby.wasm, it would be great for Python to have the same feature.

Instructions: https://github.com/kateinoigakukun/wasi-vfs/issues/5#issuecomment-1205091688. Pre-made libwasi_vfs.a library https://github.com/kateinoigakukun/wasi-vfs/releases/tag/v0.1.1

CC: @nickvidal, @rvolosatovs

kesmit13 commented 1 year ago

@rjzak The build scripts now pack the standard library into the resulting WASM file. This does create a huge WASM file though. There are environment variable described in run.sh to control whether or not the standard library should be included and whether or not to include the .pyc files.