A Glimpse into the Future of Browser-Based Python: Introducing SPy

2025-02-25
A Glimpse into the Future of Browser-Based Python: Introducing SPy

To overcome the speed limitations of Python in the browser, engineers from Anaconda and Cloudflare developed SPy. SPy isn't a simple Python port; it's a new language allowing a mix of compile-time and runtime code (blue and red code, respectively). Blue code, resembling Python, enables pre-computation at compile time, dramatically boosting performance. SPy code can be interpreted or compiled to C, then further compiled into native binaries or WebAssembly. A generative art demo showcased a 100x speed improvement by migrating from PyScript to SPy. While in early stages, SPy demonstrates impressive potential, promising near-Rust speeds for native Python execution in browsers in the future.

Read more
Development