Comments (22)
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.
from nuitka.
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.
from nuitka.
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
https://github.com/pmp-p/micropython-ports-wasm
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.
from nuitka.
Nuitka depends on "libpython" to work. If you can load that, it's fine, but I doubt it.
from nuitka.
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
from nuitka.
@rafi16jan Go ahead, you are welcome.
from nuitka.
Meh, cannot assign you, but consider yourself in charge until you give up @rafi16jan
from nuitka.
Ok, I'll report
from nuitka.
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
from nuitka.
Not enough time for Nuitka as it stands.
from nuitka.
Ok I understand
from nuitka.
Hm, rpython+wasm is an interesting option.
warning: unresolved symbol: pypy_debug_tracebacks
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.
from nuitka.
@rafi16jan I know a bit of C, I’m willing to help.
from nuitka.
Maybe we can ask on the PyPy mailing list.
from nuitka.
@CrazyPython Nice, where do we start?
from nuitka.
@wolfv Sorry for tagging you hehe, how's your experience with the new MicroPython javascript port?
from nuitka.
It's quite straightforward nowadays to compile to webassembly. you just need to know which functions to export.
Nowadays you should also be able to find libpython compiled to webassembly. however, it will be much larger than micropython (which is the big advantage). MicroPython compiled is only ~200kb, so in the same range as modern JS frameworks.
from nuitka.
@wolfv Is there already a way to interact with DOM or WebAPIs? Because I ask another port to WASM what's the difference between his port and the official port, he promises that he will add DOM interaction and even asyncio support with requestAnimationFrame. Take a look at this
from nuitka.
Not related to Nuitka, but I have make an ES6 Module of the official MicroPython WASM port. https://www.npmjs.com/package/micropython
@appcypher @ids1024 @CrazyPython
from nuitka.
Nuitka depends on "libpython" to work. If you can load that, it's fine, but I doubt it.
@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.
from nuitka.
@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
from nuitka.
@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
from nuitka.
Related Issues (20)
- Can't import numpy. numpy: This plugin has been deprecated HOT 3
- Cannot add copyright information for macOS bundles HOT 7
- error when executing an Nuitka app with easyocr HOT 13
- Must not clear "sys.meta_path" and expect module loading to work HOT 12
- Nuitka needs to link to `libroot.so` on Haiku 32-bit HOT 4
- Windows: When running the program on the EXE icon is not used for created Windows, why? HOT 3
- Build fails with pyside6 on module_name.getPackageName HOT 6
- Does Nuitka compile itself? HOT 2
- Cannot pack Python files using --include-data-dir in newer version of Nuitka HOT 3
- 编译速度太慢 HOT 7
- How to output the compiled exe file and the library file libso to different directories? HOT 20
- How to import libmagic by python libraries? HOT 2
- Bug report: upx: actions-runner: vtkrenderingfreetype-9.2.dll HOT 9
- Panda3D Dylib Bug HOT 14
- Question: Does --onefile produced dist folder equal what --standalone produces? HOT 2
- [Help] `--output-filename` shows incorrect default filename HOT 2
- CompiledCellType.c:240:1: error: invalid conversion HOT 3
- The following signatures were invalid: EXPKEYSIG 1BFC33752912B99C HOT 5
- SEGFAULT on compiled binary HOT 16
- When I publish my software to microsoft store, the package build by nuitka, It told me that products must not contain or enable malware as defined . HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuitka.