-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
Not supported: WebAssembly(wasm) #41
Comments
Nuitka depends on "libpython" to work. If you can load that, it's fine, but I doubt it. |
libpython is a C library right? isn't Webassembly compiles a LLVM compatible code (and its dependencies) to byte code? I want to try this |
@rafi16jan Go ahead, you are welcome. |
Meh, cannot assign you, but consider yourself in charge until you give up @rafi16jan |
Ok, I'll report |
After weeks of busy routines I finally have the time to try to tinker with Nuitka and the Emscripten Compiler... And no avail, everything that needs the Python Runtime won't work (Nuitka, Cython, Pyrex, I only tried these 3).. But I found RPython, basicly it have a translator/transpiler that can translate/transpile a subset of python "staticly" to C without the Python runtime. By staticly means it can't be dynamic (one variable can only be one type, no lambda, only higher order functions, etc) and it surprisingly able to be compiled with emcc (Emscripten). Although the produced llvm give an error about unresolved symbol when executed in WebAssembly: warning: unresolved symbol: pypy_debug_tracebacks Even though I know this is Nuitka Github Repo but I want to ask for your help @kayhayen and any Pythonista who are fluent in C that came accross because I think this is the right idea to bring Python to the Web (performance wise). Compiling the full CPython or any other Python Runtime will make the download size very large and bringing many problems. |
Thanks for reporting. I do not mind reading good things about PyPy, which is behind RPython. I think it is good for what it does. I actually once contributed a small patch to it, a decade ago. :) I am putting this to unsupported then, leaving the question tag, so people will find it. |
Can you (or maybe the right question is, do you have time :D) to give us newbies guide/advice to debug this RPython and the C source it generated. We younglings aren't like you guys that can understand C the same way we understand Python. It's heaven and earth to us (maybe hell). We're generation that aren't used to compile things, unless it is java or .net haha |
Not enough time for Nuitka as it stands. |
Ok I understand |
Hm, rpython+wasm is an interesting option.
Try grepping the rpython/pypy source code for that function to see where it's defined and find out why it isn't being compiled/linked properly. From the name, I'm guessing you could replace it with an empty function with the same signature, at the cost of breaking tracebacks. |
@rafi16jan I know a bit of C, I’m willing to help. |
Maybe we can ask on the PyPy mailing list. |
@CrazyPython Nice, where do we start? |
Although RPython will be the fastest subset of python for compilation, but it feels like it won't be that easy to target it to wasm. The current viable one is actually MicroPython, there are working POC for it https://github.com/numworks/epsilon/tree/master/python But I am more interested in RPython performance wise, but if it is too complex to be targeted to wasm maybe we can search for another alternative like MicroPython. |
@wolfv Sorry for tagging you hehe, how's your experience with the new MicroPython javascript port? |
It's quite straightforward nowadays to compile to webassembly. you just need to know which functions to export. |
Not related to Nuitka, but I have make an ES6 Module of the official MicroPython WASM port. https://www.npmjs.com/package/micropython |
@kayhayen libpython3.8.a is (now) easy to build with clang 10 ( emsdk tot-upstream ) and i did not find any problem running standard stdlib python code in repl. https://pmp-p.github.io/python-next/test.html patches here https://github.com/pmp-p/pydk/tree/master/sources.em If anyone would like to experiment Nuitka on that lib i'm ready to help ( i'm on gitter and freenode ) @rafi16jan i made the asyncio micropython DOM support compatible with cpython too with the same module see the test page above. |
@pmp-p @rafi16jan @wolfv @CrazyPython , i am a very experienced C/C++ programmer , i will be there for help for any C/C++ related things |
Great! Months ago I've successfully fork RPython to be able to compile to WASM. Please give any feedback here https://github.com/rafi16jan/rpython-wasm I would like to see someone continue the work since I'm busy with other things right now, also pardon me if there's bad C code since I'm very bad at C and strong typed languages in general |
It's a beautiful project you have here. I admire it quite a lot and come around once in a while to learn from it even though I don't use it directly in my work.
I understand the core developer of this project may have a lot on his plate but I've often wondered if Nuitka could have a wasm codegen phase.
The idea of having Python run in the browser is fascinating and I can't wait to see the possible applications of it. I, for one, would love to write some of my web apps in Python, I believe a lot of people would too.
I know my way around wasm and wast and I could help out with the codegen, but if there is a reason this idea won't work I would like to know.
The text was updated successfully, but these errors were encountered: