Skip to main content

PyScript: Python In The Browser by Anaconda

On Saturday Anaconda unveiled their newest project at PyCon 2022. PyScript enables users to mix Python and HTML in the browser.
Created on May 2|Last edited on May 3
On April 30, 2022 Anaconda, the maker of a "data science out of the box" distribution of Python and R, announced PyScript.
Wouldn't it be cool ... to run Python ... in your browser?

What Is PyScript?

As they describe it, "PyScript is a framework that allows users to create rich Python applications in the browser using a mix of Python with standard HTML. PyScript aims to give users a first-class programming language that has consistent styling rules, is more expressive, and is easier to learn."

Core Components Of PyScript?

What can you find in PyScript? According to the list over on PyScript.net:
  • Python in the browser: Enable drop-in content, external file hosting, and application hosting without the reliance on server-side configuration
  • Python ecosystem: Run many popular packages of Python and the scientific stack (such as numpy, pandas, scikit-learn, and more)
  • Python with JavaScript: Bi-directional communication between Python and JavaScript objects and namespaces
  • Environment management: Allow users to define what packages and files to include for the page code to run
  • Visual application development: Use readily available curated UI components, such as buttons, containers, text boxes, and more
  • Flexible framework: A flexible framework that can be leveraged to create and share new pluggable and extensible components directly in Python

Why PyScript?

The folks at Anaconda were looking for an accessible stack to support Python. They didn't want to build a new stack, they wanted something in the current ecosystem (see accessibility note above).
They landed on the browser.
I love their explanation of why:
"There are many elements that make the browser a very solid stack, such as the advancements made with WebAssembly/WASM, Emscripten, and Pyodide. The browser makes for an excellent virtual machine, even though it is not traditionally thought of as one."


Just The Beginning Of PyScript

They have noted that this is just the beginning. Carrying forward, users will be empowered with the ability for craft their own Python applications, right in the browser.
You can find out more in the Anaconda blog posts here.
And about PyScript here.
And of course there's an online demo here.
Tags: ML News
Iterate on AI agents and models faster. Try Weights & Biases today.