Learn Python with Talk Python's 270 hours of courses

What's New in PyScript [August 2023]

Episode #426, published Wed, Aug 9, 2023, recorded Thu, Jun 22, 2023

One of the most exciting initiatives in the Python space these days is pyscript which enables Python running natively in your browser. With consistent support from the folks at Anaconda, this project has been making solid strides since its initial release. On this episode we catch up with Fabio Pliger and Nicholas Tollervey to see where they are with the pyscript project.

Watch this episode on YouTube
Play on YouTube
Watch the live stream version

Episode Deep Dive

Guests Introduction and Background

Fabio Pliger is a seasoned Python developer who has been deeply involved in community building. He previously chaired EuroPython for multiple years and co-founded the Python Italia organization. He’s passionate about Python's ecosystem, especially around education and emerging areas like running Python in the browser.

Nicholas Tollervey is a principal engineer on the PyScript team at Anaconda. He has a rich history with the Python community, including work on the BBC micro:bit and other educational projects. His current focus is on Python in education and making PyScript a central platform for browser-based Python applications.

What to Know If You’re New to Python

Here are a few essentials to help you follow along with Python running in the browser:

  • Python is known for its readability and friendly community—ideal if you’re learning your first programming language.
  • PyScript relies on WebAssembly (WASM) to bring Python’s capabilities natively to the browser.
  • When the episode references “client-side” execution, it means running Python code directly within your web browser without any additional installation.

Key Points and Takeaways

  1. The Next Generation of PyScript PyScript is evolving from a simple tag-based Python runner to a more flexible platform supporting multiple runtimes and web-centric features. The new “PyScript Next” initiative aims to deliver smaller core components and better performance.
  2. MicroPython in the Browser The team collaborated with MicroPython’s creator, Damien George, to implement a robust foreign function interface (FFI) for JavaScript. MicroPython loads lightning-fast, as small as around 170kB, making it ideal for low-latency, lightweight Python apps.
  3. Platform vs. Framework PyScript is being designed as a platform on which multiple frameworks or libraries can be built. Just like Django or Flask in the server world, you’ll see new browser-focused frameworks pop up in the PyScript ecosystem.
    • Links / Tools:
  4. Bridging Python Education and the Browser Both Fabio and Nicholas emphasize how PyScript can help educators bypass locked-down school computers. Instead of installing Python, students can open a browser and code with Python immediately—ideal for learning and quick experimentation.
    • Tools / Ideas:
      • Live REPL in the browser
      • Less friction for first-time coders
  5. Synergy with Other Browser-Based Python Projects Projects like Pyodide and MicroPython have found a collaborative ally in PyScript. Rather than reinventing the wheel, PyScript’s next-gen architecture will reuse and unify the best approaches from these interpreters.
  6. PyScript.com Platform PyScript.com is a new service offering free hosting and easy sharing for PyScript-powered apps. It eliminates deployment hurdles so users can demo and distribute their Python-in-the-browser projects with just a link.
  7. Workers and Concurrency PyScript’s new version allows running Python code in Web Workers. This means truly concurrent or parallel-like behavior in the browser, keeping interfaces responsive while Python code executes.
  8. Future of Python in the Browser The interview hinted at a coming era where complex Python apps—data visualization, reactive dashboards, and more—can run purely client-side. This could give popular JavaScript frameworks some healthy competition.
  9. Creative Experiments (e.g., PyScript in a Tesla) Nicholas shared a demo running PyScript in the Tesla’s onboard browser, highlighting how any device with a modern browser can now be a Python-capable environment, including mobile phones and tablets.
  10. Open Source and Community Involvement Both guests encourage developers—veterans and newcomers—to jump into PyScript’s open-source community. They welcome feedback on GitHub, new plugins, or any creative use cases that help shape the platform’s future.

Interesting Quotes and Stories

  • On the Tesla Browser Demo “Because it’s just a browser, we stuck PyScript in a Tesla and had it honk like a goose. Python in your car—why not?”
  • On Education and Lockdown Computers “Teachers are forced into these locked environments where installing software is impossible. If you can open a webpage, you can run Python. That’s game-changing for education.”
  • The Old Days of the Web “I remember first using NCSA Mosaic… it was mind-blowing. Now, we’re using the browser as a kind of universal platform for Python code.”

Key Definitions and Terms

  • WebAssembly (WASM): A low-level binary format for running code at near-native speed in a browser.
  • PyScript: A platform allowing Python to run natively in HTML, bridging Python, JavaScript, and WebAssembly.
  • MicroPython: A lightweight Python implementation optimized for embedded devices and, now, the browser.
  • Foreign Function Interface (FFI): Mechanism to call functions across different languages or runtimes (e.g., calling JavaScript from Python).
  • Web Workers: A browser API for running scripts in background threads separate from the main UI thread.

Learning Resources

Looking to expand your Python knowledge further? Here are a few curated courses that align well with the web and Python topics in this episode:

Overall Takeaway

PyScript continues to push the boundaries of where Python can run, making the browser a first-class citizen for Python applications. With support for multiple runtimes, rapid development on platforms like PyScript.com, and a vision for empowering learners and creators, PyScript is bringing Python to devices and domains it’s never before inhabited. The excitement around Python in education, concurrency, and interactivity suggests a bright future for Python developers—and newcomers—everywhere.

Links from the show

Guests and Host Links
Nicholas Tollervey: @ntoll@mastodon.social
Fabio Pliger: @b_smoke
Michael Kennedy: @mkennedy@fosstodon.org

pyscript: pyscript.net
pyscript on Github: github.com
Tic Tac Toe Example App: pyscriptapps.com
PyperCard: github.com
MicroPython: micropython.org
pyscript core: pyscript.net
Nich's PyScript gets Python anywhere there's a browser video: youtube.com
HTMX: htmx.org
Birth and Death of JavaScript: destroyallsoftware.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

Talk Python's Mastodon Michael Kennedy's Mastodon