PyScript: Python in the Web Browser

A chainsaw can make short work of clearing out the back forty. It can also make a good horror movie. So while some people will say we don’t need another tool to allow more malicious scripting in the browser, we also know that, like any tool, you can use it or abuse it. That tool? PyScript, which is, of course, Python in the browser.


The tool is in the early experimental phase, so the project doesn’t suggest using it in a production environment yet. However, if it works well, the promise is not just that you can write browser-based applications in Python — you’ll have a handy way to reuse existing Python code and even be able to run the same code on the browser that currently runs on the server. This has a lot of implications for improved client/server applications, or cases where you want to be able to run against a local backend when disconnected and a remote backend when you do have a connection. Of course, you can interoperate with JavaScript, too.



However, the real goal is to make web-based programming accessible to beginners in the same way as programming systems like Scratch or JSFiddle do. As such, the actual project is less of a piece of software and more of an integration between existing pieces. 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.


PyScript wouldn’t be possible without building on top of a recent version of Pyodide—a CPython interpreter compiled with emscripten to WebAssembly, enabling Python to run in the browser. PyScript provides a thin abstr ..

Support the originator by clicking the read the rest link below.