Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile a WebAssembly module From Python3 #258

Open
yourlovemyall opened this issue Jan 17, 2022 · 4 comments
Open

Compile a WebAssembly module From Python3 #258

yourlovemyall opened this issue Jan 17, 2022 · 4 comments

Comments

@yourlovemyall
Copy link

Compile a WebAssembly module From Python

Is there currently planned support? I am looking forward to using it.

@sbc100
Copy link
Member

sbc100 commented Jan 17, 2022

It depends what are trying to do exactly.

Are you trying to build a module form scratch? If so, then https://pypi.org/project/pybinaryen/ is probably what you want.

Or are you trying to build from C/C++ sources, in which case you probably just want to call out to emcc as a subproccess.

Or are you trying to run python code inside of webassembly, in which case you probably are looking for https://github.com/pyodide/pyodide

@yourlovemyall
Copy link
Author

I want to build Python Code into wasm file , then run wasm file in wasmerio
https://github.com/wasmerio/wasmer-go

@RReverser
Copy link
Member

You can't compile Python code to Wasm, because Python is a dynamic language and Wasm is intended as a target for statically typed languages. Your best bet is running it in something like Pyodide which @sbc100 linked above.

@RReverser
Copy link
Member

RReverser commented Jan 18, 2022

OTOH, if you're going to run Python in Pyodide, Pyodide in Wasmer, and, in turn, use Wasmer from Go, that just keeps adding levels of indirection which would likely lead to very poor performance... why not invoke Python executable directly from Go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants