LinuxCommandLibrary

pygbag

Package Pygame games for web browsers

TLDR

Package game for web

$ pygbag [path/to/game]
copy
Specify output directory
$ pygbag --build [path/to/game]
copy
Run development server
$ pygbag --dev [path/to/game]
copy
Custom archive name
$ pygbag --archive [name] [path/to/game]
copy
Specify template
$ pygbag --template [template.html] [path/to/game]
copy

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.

SEE ALSO

pygame(1), python(1), emcc(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community