Skip to content

PurpBatBoi/raylib-python-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raylib Python Examples

Python 3.10+ Code style: black Type checked: mypy

A collection of practical examples demonstrating audio, graphics, and game development with Raylib and pyray in Python, with PyGLM for vector/matrix math in advanced rendering examples.

Features

  • 📦 Multiple example categories: Audio, textures, input, and more
  • 🎯 Modern Python: Type hints, dataclasses, and Python 3.14 best practices
  • 🧮 GLM math support: Uses PyGLM for vector/matrix math in advanced shader examples
  • Validated code: All examples pass mypy type checking and black formatting
  • 🔧 Easy setup: Single venv and pip install

Quick Start

Prerequisites

  • Python 3.10 or higher
  • pip (usually included with Python)
  • PyGLM (installed via requirements.txt)

Installation

# Clone the repository
git clone https://github.com/PurpBatBoi/raylib-python-examples.git
cd raylib-python-examples

# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Running Examples

After activation, run any example:

python main.py
python AUDIO/audio_module_playing.py
python AUDIO/audio_sound_positioning.py

Browse the repository structure to explore all available examples by category.

Code Quality Checks

Install dev dependencies and run validation:

pip install -r requirements-dev.txt

# Format code
python -m black AUDIO/audio_module_playing.py

# Type check
python -m mypy AUDIO/audio_module_playing.py

# Check all files
python -m mypy $(find . -name "*.py" -not -path "./.venv/*")
python -m black --check $(find . -name "*.py" -not -path "./.venv/*")

Style Guide

This project follows a comprehensive style guide. See STYLE_GUIDE.md for detailed conventions including:

  • pyray API usage
  • Type hint requirements
  • Python 3.14 best practices
  • Code formatting and validation rules

Contributing

Contributions are welcome! Please ensure all code:

  1. Follows the style guide in STYLE_GUIDE.md
  2. Passes mypy type checking
  3. Is formatted with black
  4. Includes appropriate docstrings
  5. Uses pyray APIs for primary examples

Resources

License

This project is licensed under the zlib License. See LICENSE.

These examples are Python ports of the original raylib C examples. Original raylib examples and assets remain credited to their respective authors.

AI use disclosure: AI agents were used as an implementation, refactoring aid and experimentation purposes.

About

A collection of practical examples demonstrating audio, graphics, and game development with Raylib and pyray in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors