pygbag
Package Pygame games for web browsers
TLDR
Package game for web
SYNOPSIS
pygbag [--build] [--dev] [options] path
DESCRIPTION
pygbag packages Pygame applications for deployment in web browsers by compiling Python code to WebAssembly using Emscripten and Pyodide. The resulting build runs directly in modern browsers without plugins, making it straightforward to share Python games and multimedia applications online.
The tool includes a built-in development server for local testing before deployment. Games must use async Python patterns with asyncio to work within the browser's event loop model. pygbag handles asset bundling, HTML template generation, and the WebAssembly compilation pipeline, producing a self-contained web application from a standard Pygame project.
PARAMETERS
--build
Build only, no server.--dev
Development mode.--archive NAME
Archive filename.--template FILE
Custom HTML template.--cdn URL
CDN base URL.--title TITLE
Page title.
CAVEATS
Not all Python libraries work. Async code required. Large download size.
HISTORY
pygbag was created to bring Pygame games to web browsers using WebAssembly and Pyodide.
