Say Hello to PyScript (WebAssembly Python)
Episode Deep Dive
Guests Introduction and Background
Fabio Pliger is a seasoned Python developer who has been deeply involved with the Python community for many years. He’s a core developer at Anaconda and has worked on notable data-focused projects such as Bokeh. Fabio has helped organize several Python conferences, including PyCon Italy and EuroPython, and he’s now spearheading the PyScript project, aiming to bring Python natively into the browser.
What to Know If You’re New to Python
Here are a few essentials to help you get the most out of this PyScript-focused conversation:
- Understand the basics of Python’s syntax and its ecosystem (e.g., common libraries, virtual environments).
- Know that Python can interact with JavaScript in the browser through special runtimes (like PyScript’s integration with Pyodide).
- Familiarize yourself with the idea of using Python for front-end or web-related tasks—this can be very different from traditional server-side or scripting uses.
- Be aware that PyScript is in early development, so things may change quickly.
Key Points and Takeaways
PyScript’s Ambition: Python in the Browser PyScript is a framework that enables you to run Python code directly in the browser, leveraging WebAssembly and Pyodide. It’s designed to lower the barrier to building web applications by minimizing configuration steps and letting you keep everything in a single HTML page.
- Links and tools:
Powered by Pyodide and WebAssembly Under the hood, PyScript relies on Pyodide, a port of CPython compiled to WebAssembly. This means true Python (rather than a partial port) can run client-side without server calls for computation. It supports many packages, including NumPy and other scientific libraries.
- Links and tools:
Interactive Front-end Possibilities With PyScript, developers can add
<py-script>
tags, run Python code, and even mix in UI elements, animations, or data visualizations. Python code can call JavaScript functionality and vice versa, opening the door for highly interactive Python-driven UIs.Where PyScript Shines While pure HTML pages typically don’t need Python in the browser, more interactive dashboards, data experiments, or educational apps can really benefit. By offloading compute to the user’s browser, developers can reduce server costs and infrastructure overhead.
- Tools:
Performance and Loading Times WebAssembly-based apps often load a ~3–5MB runtime, which can feel large for minimal demos. However, once cached, subsequent loads are faster. For more substantial apps (think Jupyter-like or offline data science tools), the upfront cost is acceptable.
- Tools:
- JupyterLite (another Pyodide-based approach)
- Browser caching & bundling techniques
- Tools:
Data and File Handling in the Browser PyScript provides ways to load external Python modules or data files right inside HTML via
<py-env>
and the MicroPip system. While it’s still evolving, developers can fetch remote files, parse CSVs, or handle local storage using browser APIs without needing a traditional server.- Tools:
- MicroPip for installing packages
- Fetch API for browser-based file access
- Tools:
Integration with the Broader Python Ecosystem Projects like Bokeh, Jupyter, and many others have proven that Python can be an excellent environment for interactive, data-centric tasks. PyScript extends this idea to the browser itself, hoping to unify Python’s web presence with minimal setup.
- Tools:
- Jinja (templating library), which reportedly “just works” under PyScript
- Jupyter notebooks
- Tools:
Collaboration with CPython and Future of PyScript The PyScript team, together with Pyodide and CPython core developers, is working to minimize fragmentation. As CPython gets more robust WebAssembly support, PyScript will continue improving performance, packaging, and the interactive development experience.
- Tools:
Use Cases: Education, Visual Demos, Offline Computing From teaching Python with a simple
<py-script>
block to building offline-friendly data analysis apps, PyScript can help avoid server complexities. Everyone from educators to data scientists can quickly prototype or share Python-based applications via a single HTML file.- Tools & resources:
- Anaconda (Fabio’s organization background)
- Example: “Anti-gravity” floating comic demo from the conversation
- Tools & resources:
Community and Open-Source Development PyScript is open source, welcoming contributors to improve documentation, add new features, or refine its APIs. Fabio emphasizes that stable versions and best practices will come from communal feedback and real-world usage, so early adopters are encouraged to share.
- Links:
Interesting Quotes and Stories
- Fabio on the Python Community: “You come for the language, you stay for the community. That is really my experience.”
- On PyScript’s Potential: “We can view the browser as a mini-VM, and Python can live entirely there—no server round trips needed.”
Key Definitions and Terms
- WebAssembly (WASM): A low-level binary instruction format for a stack-based virtual machine—enabling near-native speed for languages like C, C++, and Python compiled to run in the browser.
- Pyodide: A WebAssembly port of CPython enabling many popular Python packages in the browser.
- MicroPip: A lightweight “pip-like” tool for installing pure Python wheels and packages in a Pyodide-based environment.
Learning Resources
If you want to go deeper into Python and some of the concepts from this episode, here are a few courses:
- Python for Absolute Beginners: Perfect starting point if you're completely new to Python.
- Anvil: Web Apps with Nothing but Python: Learn to build full-stack apps using Python only—no separate JS, HTML, or CSS layers.
- Building Data-Driven Web Apps with Flask and SQLAlchemy: For a more traditional approach to building Python-powered web apps on the server side.
- Reactive Web Dashboards with Shiny: Explore another option for interactive web dashboards in Python.
Overall Takeaway
PyScript represents a fresh opportunity for Pythonistas to build interactive, browser-based applications without having to switch languages or rely exclusively on traditional web frameworks. By running Python securely and efficiently in the browser via WebAssembly, it unlocks new frontiers in education, data visualization, and beyond—all while harnessing the vibrancy of the Python ecosystem.
Links from the show
PyScript: pyscript.net
Birth and Death of Javascript: destroyallsoftware.com
Power On: The Story of Xbox: xbox.com
PyScript source: github.com
JupyterLite: jupyterlite.readthedocs.io
Compiling CPython for WebAssembly: python.org
Space WebGL Demo: pyscript.net/examples
Antigravity Demo: pyscript.net/examples
D3 Demo: pyscript.net/examples
Most examples: pyscript.net/examples
Michael's pyscript PWA YouTube video: youtube.com
Watch this episode on YouTube: youtube.com
Episode transcripts: talkpython.fm
--- Stay in touch with us ---
Subscribe to Talk Python on YouTube: youtube.com
Talk Python on Bluesky: @talkpython.fm at bsky.app
Talk Python on Mastodon: talkpython
Michael on Bluesky: @mkennedy.codes at bsky.app
Michael on Mastodon: mkennedy