Ironically this is solved already by the latest release of Graal, one of WASM's competitors:

https://medium.com/graalvm/whats-new-in-graalvm-languages-16...

You can now distribute Python applications or libraries as standalone binaries or JAR files without any external dependencies. The Truffle framework on which GraalPy is built, and the Sulong LLVM runtime that GraalPy leverages for managed execution of Python’s native extensions, enable virtualization of all filesystem access of Python applications, including those to the standard library and installed packages.

So now you can build a standalone executable as follows:

graalpy -m standalone binary - module my_script.py - output my_binary

or a JAR file that runs on GraalVM and includes GraalPy as follows:

graalpy -m standalone java - output-directory MyJavaApplication - module my_script.py

The first form creates a fast starting native binary. The second is a portable bytecode standalone file. So this WASM dream is delivered already, just by a different group of people.

Now, GraalPy is a different implementation to CPython so not all Python apps run on it yet. But obviously any WASMPy would have the same issue.

Wow, that's pretty awesome!

I don't know if WASMpy would be a completely different implementation, or just CPython compiled against a WASM target. Probably the latter. Which has already been done.

https://github.com/jupyterlite/jupyterlite