I have some existing Python code that I would like to run in the browser, without having to rewrite it in JavaScript. Has anyone used any of the tools that allow the use of Python in the browser?<p>There seem to be two classes of such tools:<p>1. Python interpreters written in JavaScript. These include Brython [1], Skulpt [2] and Batavia [3].<p>2. Compilers (a.k.a. transpilers) that convert Python code directly into JavaScript. I would expect this to provide better performance than an interpreter, but perhaps be a less accurate Python implementation. This seems to be the approach taken by Transcrypt [4].<p>Has anyone used any of the above, or similar tools? How did you find them in terms of compatibility, performance etc?<p><pre><code> [1] https://brython.info/
[2] https://skulpt.org/
[3] https://github.com/beeware/batavia
[4] https://www.transcrypt.org/</code></pre>
There is also python interpreters compiled to webassembly<p>see: <a href="https://pmp-p.github.io/micropython-next/" rel="nofollow">https://pmp-p.github.io/micropython-next/</a><p>see: <a href="https://hyperdev.fr/pypyjs-todomvc/" rel="nofollow">https://hyperdev.fr/pypyjs-todomvc/</a>
yes, I'm using pyodide <a href="https://github.com/iodide-project/pyodide" rel="nofollow">https://github.com/iodide-project/pyodide</a> to build<p><a href="https://epiphany.pub/post?refId=d40c08258ef10f2fe9acff4ab738edc3478e8f5deb232f59082bda5e321529c6" rel="nofollow">https://epiphany.pub/post?refId=d40c08258ef10f2fe9acff4ab738...</a><p>the loading time is a bit long, because the matplotlib package is too large. loading python runtime is actually fast.<p>compatibility should be 99%, as this is the same cpython built for web.