Skip to main content

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:

  • stretch fills the browser viewport.
  • fit preserves the game's aspect ratio.
  • pixel-perfect uses integer scaling when possible.
  • native displays 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.py is required.
  • Hidden paths, virtual environments, caches, node_modules, build, and rayport.toml are 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.
  • Python packages installed on the host are not copied automatically. Pure Python packages can be included inside the game directory; native extension modules such as .so and .pyd cannot run in the WebAssembly runtime.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rayport-0.3.0.tar.gz (7.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rayport-0.3.0-py3-none-any.whl (7.7 MB view details)

Uploaded Python 3

File details

Details for the file rayport-0.3.0.tar.gz.

File metadata

  • Download URL: rayport-0.3.0.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

Hashes for rayport-0.3.0.tar.gz
Algorithm Hash digest
SHA256 84aaa0d025b221325db0bc51019d05f084b0cd9690abf45dcf77f367768d51bd
MD5 a7b981b0f141bcea1bb03ef240e4e32b
BLAKE2b-256 29511c936c57ccb0728eab07f75910d38e347ce33aa26018249319a31689f52f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rayport-0.3.0.tar.gz:

Publisher: release.yml on atarigo/rayport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rayport-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: rayport-0.3.0-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

Hashes for rayport-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cd667a1e74e4eae2edc881e8f550253aa90a5e0508d3dd775a67eef583d17c4
MD5 8a46365edb2c8958340c2c984faabff8
BLAKE2b-256 47ed1f9fbfb527f64fdd4e97ebeb0adb86e98cd24b4dd25195c810746b5bc809

See more details on using hashes here.

Provenance

The following attestation bundles were made for rayport-0.3.0-py3-none-any.whl:

Publisher: release.yml on atarigo/rayport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page