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.
  • Rayport follows imports reachable from main.py and copies required pure Python packages from the game's .venv or venv.
  • 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 .so and .pyd are 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.gz under .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


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.1.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.1-py3-none-any.whl (7.7 MB view details)

Uploaded Python 3

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

Hashes for rayport-0.3.1.tar.gz
Algorithm Hash digest
SHA256 82eecfdae5f5a7397c7497eca44e44abe356e894694254aa4cb5d2630228a0ca
MD5 2a279a63d9f1aa339bdc458ccfba3361
BLAKE2b-256 7f7f12b28e79a4d6204f5d2c9d2b3368f0b7b9b06e3fe81cc4a206c164f6a1b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for rayport-0.3.1.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.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

Hashes for rayport-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4be24ea5f2887ebce8bb5a563820efae358d2fa155a89bf123c4bc27d2b2009
MD5 3a74994da57f3a4f27f49ab1450e3983
BLAKE2b-256 58cc0fa6f5b9617a1f837ee037a23e411a93bba90a8f758c379f17f78c0503a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rayport-0.3.1-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