beeware/batavia

Compiling a module to bytecode in the build process

lielfr opened this issue · 1 comments

Hi.
So, I'm trying to implement the exec builtin. As you may know, it requires the ability to execute python code directly from batavia, which AFAIK is not possible because CPython is required for compiling into bytecode.
The two possibilites I though about are implementing a compiler in javascript and making a bridge module and compiling it when building batavia.
Which one is better for that purpose?
Thanks.

A self-hosting Python compiler will the better long term solution; but exposing the server-side implementation of exec() as something that can be invoked over a HTTP call will be the easier approach to implement.

The server-side version will be a lot slower to run, and obviously won't work if the webpage is offline, but will probably be sufficient for many purposes.