PyScript: Python in the web browser
A chainsaw can do a short job of clearing the back forty. It can also make a good horror movie. So while some people will say that we don’t need another tool to allow more malicious scripts into the browser, we also know that like any tool, you can use it or abuse it. This tool ? Pythonwhich is, of course, Python in the browser.
However, the real goal is to make web programming accessible to beginners in the same way that programming systems like Scratch or JSFiddle do. As such, the actual project is less software than an integration between existing elements. According to the post:
PyScript is a Single Page Application (SPA) written in TypeScript using the Svelte framework, styled with Tailwind CSS, and bundled with rollup.js.
So how hard is it to create PyScript code? Not very:
Hello, World! print("Hello, World!")
What is interesting is that it does not require any server configuration. Save this text to a file, open it in a browser and it runs. Well, of course, no server configuration for you. Presumably, the work is done on the pyscript.net server which takes a lot of configuration! There’s also a bit of a load time for something so simple, as you’d expect, especially on the first load. However, you can host your own server.
Some people will love it, and some people will hate it. Anyway, it’s here, and if you have to script in the browser, you could do worse than Python. We still hang on to Fortran, though maybe we should switch to Forth.