PyScript: Python in Browser

What is PyScript?

PyScript is a framework that allows users to create Python applications in browser by using Python in standard HTML. PyScript aims to provide users first class programming language experience by providing consistent styling rules, more expressive and easier to learn. Anaconda’s CEO Peter Wang announced this new technology at PyCon US 2022.

Core components:
  • Python in browser
  • Python ecosystem: Runing many popular modules of python in browser.
  • Environment management: Allow users to manage which package and files to include.
  • Visual Application Development: No need to worry about deployment as everything happens in web browser.
  • Python with Javascript: Bidirectional communication between python and javascript.
  • Flexible framework.
How does it work?

             PyScript is built on Pyodide. Pyodide is a port of CPython to WebAssembly / Emscripten. Pyodide makes it possible to install and run Python packages in the browser with micropip. Web assembly is a technology that makes it possible to write websites in Python. It uses a human readable .wat text format language, which then gets converted to a binary.wasm format that browsers can run.

Aim:
  • Offer clean and simple API
  • Support standard HTML
  • Extend HTML to read custom components that are opinionated and reliable.
  • Provide a pluggable and extensible components system.
PyScript Techstack:

PyScript is an experimental project, very alpha and under heavy development. Javascript won’t die because of PyScript. Only it’s popularity may decrease as it relates to web development. The Project is developed by Anaconda.

In the next article, I will let you know about running python in HTML with hello world program example and attach the link below.

How to run python in HTML?

References:
  1. https://anaconda.cloud/pyscript-python-in-the-browser
  2. https://pyscript.net/