Package raylib Python games for the web
Project description
Rayport
Package Python raylib games as static files that run in a web browser.
Rayport includes the browser runtime needed to package a game. You do not need a separate raylib installation or compiler.
Installation
Install Rayport as an isolated command-line tool:
uv tool install rayport
or:
pipx install rayport
Rayport requires Python 3.13 or newer. Python 3.13 and 3.14 are tested.
Quick start
Your game directory must contain main.py:
my-game/
├── main.py
└── assets/
Start a local server with automatic rebuilding:
rayport dev ./my-game
Create a static web build:
rayport build ./my-game --output dist
Upload the contents of dist/ to a static web server. The generated game must
be served over HTTP or HTTPS; opening index.html directly with file:// is not
supported.
Commands
Check the installed version:
rayport --version
See which files will be packaged:
rayport inspect ./my-game
rayport inspect ./my-game --excluded
rayport inspect ./my-game --explain tests/test_game.py
rayport inspect ./my-game --sizes
Rayport marks generated directories with .rayport-output. It will not replace
an unrelated non-empty directory unless you explicitly pass --force-output.
Run rayport COMMAND --help for every available option.
Project configuration
Place rayport.toml in the game directory:
config-version = 1
[web]
title = "My Game"
presentation = "stretch"
background = "#1a1a2e"
[package]
exclude = [
"tests/**",
"debug/**",
"demo/**",
"screenshots/**",
]
include = []
Presentation modes:
stretchfills the browser viewport.fitpreserves the game's aspect ratio.pixel-perfectuses integer scaling when possible.nativedisplays one CSS pixel per game pixel.
The game controls its render resolution through InitWindow(). Command-line
options override rayport.toml, which overrides Rayport defaults.
Packaging behavior
main.pyis required.- Hidden paths, virtual environments, caches,
node_modules,build, andrayport.tomlare excluded by default. - Images, audio, and other assets are packaged without conversion.
- Symbolic links, FIFOs, sockets, devices, and other non-regular files are rejected when they would be included.
- Rayport follows imports reachable from
main.pyand copies required pure Python packages from the game's.venvorvenv. - Install the game's dependencies before building. Missing packages are reported during the build instead of failing later in the browser.
- Native extension files such as
.soand.pydare skipped because they cannot run in the WebAssembly runtime. Packages with a pure Python fallback, including PyYAML, can still work. - Dependency versions, skipped native files, and available license files are
recorded inside
game.tar.gzunder.rayport/.
Compatibility
- Rayport CLI: Python 3.13 and 3.14 tested on Linux, macOS, and Windows.
- Browser runtime: CPython 3.12.11 and raylib 5.5.
- Browser: Chromium is tested automatically.
- Firefox and Safari have not been verified yet.
Because the browser runtime uses CPython 3.12, game code must be compatible with Python 3.12 even when the Rayport CLI runs on a newer Python version.
License
Rayport is licensed under the Eclipse Public License 2.0. Generated builds include Rayport and third-party license notices. The license does not apply to independent game code merely packaged by Rayport.
See the third-party notices for additional information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rayport-0.3.1.tar.gz.
File metadata
- Download URL: rayport-0.3.1.tar.gz
- Upload date:
- Size: 7.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82eecfdae5f5a7397c7497eca44e44abe356e894694254aa4cb5d2630228a0ca
|
|
| MD5 |
2a279a63d9f1aa339bdc458ccfba3361
|
|
| BLAKE2b-256 |
7f7f12b28e79a4d6204f5d2c9d2b3368f0b7b9b06e3fe81cc4a206c164f6a1b4
|
Provenance
The following attestation bundles were made for rayport-0.3.1.tar.gz:
Publisher:
release.yml on atarigo/rayport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayport-0.3.1.tar.gz -
Subject digest:
82eecfdae5f5a7397c7497eca44e44abe356e894694254aa4cb5d2630228a0ca - Sigstore transparency entry: 2226769309
- Sigstore integration time:
-
Permalink:
atarigo/rayport@9aacc8087eb8a6785f04bd07779622bee72d0d64 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/atarigo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9aacc8087eb8a6785f04bd07779622bee72d0d64 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rayport-0.3.1-py3-none-any.whl.
File metadata
- Download URL: rayport-0.3.1-py3-none-any.whl
- Upload date:
- Size: 7.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4be24ea5f2887ebce8bb5a563820efae358d2fa155a89bf123c4bc27d2b2009
|
|
| MD5 |
3a74994da57f3a4f27f49ab1450e3983
|
|
| BLAKE2b-256 |
58cc0fa6f5b9617a1f837ee037a23e411a93bba90a8f758c379f17f78c0503a1
|
Provenance
The following attestation bundles were made for rayport-0.3.1-py3-none-any.whl:
Publisher:
release.yml on atarigo/rayport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayport-0.3.1-py3-none-any.whl -
Subject digest:
a4be24ea5f2887ebce8bb5a563820efae358d2fa155a89bf123c4bc27d2b2009 - Sigstore transparency entry: 2226769834
- Sigstore integration time:
-
Permalink:
atarigo/rayport@9aacc8087eb8a6785f04bd07779622bee72d0d64 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/atarigo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9aacc8087eb8a6785f04bd07779622bee72d0d64 -
Trigger Event:
push
-
Statement type: