If you are an indie game developer who writes in Python, you know the pain of putting your game on the web.
For years, the standard advice has been pygbag or compiling Pygame to WebAssembly. While these tools are incredible, the developer experience is often rough. You have to wrestle with build steps, configure static files, deal with massive payloads, and hope the browser doesn't freeze while loading.
I love Python. I love web browsers. I hated how hard it was to combine them.
So, I built Pytml.
It started as a tiny 15KB wrapper to run Python in HTML. But today, I am officially releasing Pytml v2.6.0, which turns it into a complete, zero-config environment for building games and interactive tools in the browser.
Here is what’s new, and how it works under the hood.
The Game Kit: Python Games in a Single Script Tag
Pytml v2.6 embeds a lightweight Game Kit (pytml.game) directly into the runtime.
You don't need to install anything. You don't need a requirements.txt. You add one script tag to an HTML file, and you instantly have access to a game loop, touch joysticks, canvas rendering, and collision detection.
Here is a fully playable game loop in Python:
from pytml import joystick, interval # Create a touch joystick on the page stick = joystick("stick") def update(): # Read the joystick x/y values natively x = stick.joystick_x y = stick.joystick_y # Move your player, update canvas... move_player(x, y) # Run the game loop at 60 FPS without blocking the UI interval(update, 1000 // 60) Because it runs on Pyodide (CPython compiled to WebAssembly), you still have access to the entire Python ecosystem. If you want to use random to generate enemies or math for vectors, it just works.
The Persistent Cache (Goodbye 6MB Load Times)
The biggest complaint about Python-in-the-browser is the initial 6MB download for the WebAssembly runtime.
In v2.6, I built a persistent cache system using the browser's Cache Storage API. When a user loads your game for the first time, the runtime downloads in the background. Every subsequent visit loads instantly from the local cache.
Try it out
Pytml is Apache 2.0, officially listed in the Pyodide related-projects directory, and has earned a 100% OpenSSF Best Practices passing badge.
If you're a Python dev who wants to make games, or a teacher who wants students to run code without installing Python, give it a shot.
- Play the Demo: pytml.js.org/demo
- Check out the new website: pytml.js.org
- GitHub: github.com/NodeX-AR/Pytml



