This uses Pyodide [0] under the hood [1], which is CPython compiled to WebAssembly. In all my tests of it, loading takes a long time ~5 seconds. Coldbrew [2], another distribution of CPython on Wasm, is another option with similar load times.<p>And Brython [3] is a completely different option without long load time: a Python interpreter implemented in JavaScript.<p>If load time is important, Brython is pretty nice. If feature completeness is important, Pyodide and Coldbrew are probably best.<p>[0] <a href="https://github.com/pyscript/pyscript/blob/main/pyscriptjs/src/App.svelte#L15" rel="nofollow">https://github.com/pyscript/pyscript/blob/main/pyscriptjs/sr...</a><p>[1] <a href="https://github.com/pyodide/pyodide" rel="nofollow">https://github.com/pyodide/pyodide</a><p>[2] <a href="https://github.com/plasticityai/coldbrew" rel="nofollow">https://github.com/plasticityai/coldbrew</a><p>[3] <a href="https://github.com/brython-dev/brython" rel="nofollow">https://github.com/brython-dev/brython</a>
For some reason, I can't see this linked anywhere on the site, but there is an examples page:<p><a href="https://pyscript.net/examples/" rel="nofollow">https://pyscript.net/examples/</a><p>(This was presented today as a pycon keynote talk!)
Based on the responses, I assume this is a silly question, but why? Why would I want to run Python in HTML?<p>Does Python have some libraries that JS is missing? (I could think of AI/ML libs) The examples [1] seem so slow in my browser (Firefox on an Intel-based MBP) that they are borderline unusable for me (and some of them just straight out don't load within 60 seconds, like the Bokeh, at which point I give up).<p>[1] <a href="https://pyscript.net/examples" rel="nofollow">https://pyscript.net/examples</a>
This is awesome and has so much potential!<p>Regarding the size of the download, I know there is ongoing work in the Pyodide project to create a much smaller python runtime that will help tremendously. Also, the script will be cached once you download it once.<p>EDIT: Also, you don't need NPM or anything locally to run these
The GitHub repo has a more concrete overview.<p><a href="https://github.com/pyscript/pyscript" rel="nofollow">https://github.com/pyscript/pyscript</a><p>Would be nice if there was a demo on the page that didn’t require installing NPM and other stuff on my machine.
I really really like this, but 4 MB zipped is a bit of a hard sell :/ I've had a need to deploy small ad-hoc HTML tools at work, though, and my Python is much better than my JS, so maybe it's worth it.
I've learned to accept my larger snake overlord. I know a lot of people work very hard on the anaconda project. It is a fork of what I consider to be actually pythonic. I am pretty sure there are a lot of big money actors working in the space to "Embrace, Extinguish, Destroy" what I know to be Python via the Anaconda project. This is really interesting stuff and is the first evidence I've seen other than money and some very specific political stuff that shows me they might do something worth something. Congrats! I will use this! I mourn what's lost, but embrace the future.
Looks pretty cool! we recently release <a href="https://play.strawberry.rocks" rel="nofollow">https://play.strawberry.rocks</a> which also uses Pyodide, can't wait to have more python stuff in the browsers!
Is this similar at all to the old pyjs/pyjamas project? I had some fun playing with that but there was no way I would have ever actually made anything serious with it.
Thank you for posting this.<p>Of course it would be better if Chrome shipped with Python support, but this is a good effort. Does Wasm generally support other languages ?
Pyodide is really cool, we got a Python library we were working on working in JS in the browser with it, including Pandas iirc, without too much trouble (though getting http requests working required a little hackery).
Python is the worst language to script anything inside a markup language that does not need to be structured like Python (HTML). So yeah, a good experiment, but unfortunately it is doomed to fail.
cool project, check out <a href="https://gradio.app/" rel="nofollow">https://gradio.app/</a> as well, makes a web demo with just python