replace javascript with brython !

Hi,
have a look here, as an alternative of transcrypt:

https://brython.info/


(log in to comment)

Comments

I gave brython a try a while ago.  It was pretty neat, though pretty buggy and incomplete at the time.  I'm sure it has matured since then.  It transpiles the Python code to JavaScript, so the interop is quite good.

I briefly investigated whether this would work with the WebGL port of Panda3D.  The main limitation that made me drop it was that Brython relied on JavaScript's garbage collector, which does not have finalizers, so there is no working __del__.  This makes it impossible to manage external memory resources (such as memory managed by C/C++ libraries that have been compiled to ASM.js/WebAssembly).

Batavia is also worth checking out, though it appears to have the same limitation:
https://beeware.org/project/projects/bridges/batavia/

Brython does not really transpile Python to JavaScript, at least not in the way Transcrypt does*. It's basically a full implementation of Python in JavaScript and it's at a stage where it is very compatible indeed with Python 3.7: most of the Python standard library that is sensible to use in the browser works in the browser.

* Brython does generate JavaScript code internally, but this is an implementation detail/optimisation.

Batavia is almost exactly the same concept as Brython, but doesn't include the parser/compiler, probably mainly to make it quicker to implement. I spoke to Russell Keith-Magee at PyCon but I don't think he was aware how similar the projects are. I think mainly Brython has a branding/mindshare problem. Technically it's already👌.


(I was looking into this for adventurelib.)