Description
Summary
RustPython in the web can be one of it's best use cases
The python community have been pushing to have python run in the browser.
Many such implementations have been brython, skulpt, Batavia etc.
Likened with batavia's approach to run python bytecode
in the browser, I have been wondering if rustpytgon can ship only it's virtual machine to do similar task
Detailed Explanation
Rustpython's wasm module currently is about 4.5mb. thus size is too big to be inculcated in most projects.
However I believe if we could remove the parser, lexer and other compiler related stuff and compile only the virtual machine, the size will drastically reduce.
This approach will also require that apps get compiled on their maybe machines before the bytecode is shipped.
Drawbacks, Rationale, and Alternative
Rationale:
It will take a long time for RustPython to get to compete with cpython natively(where cpython works well already) but the web is one place where competition is less. If this works, we can have web apps fully written in python(little to no javascript)
Be able to run already existing software on the web.
This can also lead to the revolution of building front end livraries. Like implementing python alternatives to react, angular, Vue etc.
Currently, the beeware team have been working hard to have the Toga(beewae's gui library) working in browsers but are limited by the size of Batavia.
I may certain everyone loved Anvil.works for their idea of creating web apps completely in python.
Possible Drawback:
Since apps will need to be compiled before shipped and most people use cpython, rustpython's vm must be able to run cpython generated bytecode
This may not even be an issue but I raise this because I'm unaware of the bytecode implementation.