# What Python Version Does RomM Backend Require?

> Discover the Python version required for the RomM backend. Ensure compatibility with Python 3.13 or newer for optimal performance. Learn more about RomM's dependencies.

- Repository: [The RomM Project/romm](https://github.com/rommapp/romm)
- Tags: faq
- Published: 2026-07-07

---

**RomM's backend requires Python 3.13 or newer**, as explicitly declared in the project's `uv.lock` dependency lock file with the constraint `requires-python = ">=3.13"`.

RomM is a self-hosted game library manager that organizes and serves your ROM collection through a modern web interface. The backend is built on **FastAPI**, **SQLAlchemy 2.0**, and an async-first architecture that demands **Python 3.13 or newer** to function correctly. This version requirement ensures access to the latest performance optimizations and language features required by the distributed services (Redis, RQ, Socket.IO) that power the application.

## Where RomM Defines the Python Version Requirement

The authoritative source for RomM's Python version requirement is the **`uv.lock`** file located in the repository root. This dependency lock file explicitly pins the runtime requirement with the following declaration:

```toml
requires-python = ">=3.13"

```

According to the RomM source code, this constraint ensures that all modern language features and library versions used throughout the backend remain fully supported. The `uv` toolchain uses this specification to enforce reproducible builds across development and production environments.

## Why Python 3.13 Is Required

RomM's backend relies heavily on **asynchronous I/O**, advanced **type-hinting**, and the latest standard-library modules. Python 3.13 introduces specific improvements that the codebase benefits from:

- **Enhanced `asyncio` capabilities** for better task scheduling and cancellation across the FastAPI endpoints and Socket.IO handlers.
- **Updated `typing` constructs** that simplify complex API schemas used in Pydantic models and SQLAlchemy 2.0 declarations.
- **Improved error handling and diagnostics** that aid in debugging distributed services including Redis and RQ (Redis Queue) workers.

Requiring at least Python 3.13 guarantees that developers and deployment environments have these features available out of the box, eliminating compatibility issues with modern Python async patterns.

## Backend Code Patterns That Rely on Python 3.13+

The RomM backend utilizes language features and optimizations that assume a Python 3.13+ runtime. Below are representative code patterns from the codebase that depend on these modern capabilities.

### FastAPI Endpoint with Modern Type Hints

In [`backend/main.py`](https://github.com/rommapp/romm/blob/main/backend/main.py) and related router files, endpoints use union type syntax and generic collections that require recent Python versions:

```python
from fastapi import APIRouter, Depends
from pydantic import BaseModel

router = APIRouter()

class GameQuery(BaseModel):
    title: str
    platform: str | None = None

@router.get("/api/games", response_model=list[Game])
async def list_games(query: GameQuery = Depends()) -> list[Game]:
    """Fetch a list of games matching the query."""
    # Async DB call using SQLAlchemy 2.0

    async with async_session() as session:
        result = await session.execute(
            select(Game).where(Game.title.ilike(f"%{query.title}%"))
        )
        return result.scalars().all()

```

### Background Tasks with Redis RQ

The [`backend/utils/background_tasks.py`](https://github.com/rommapp/romm/blob/main/backend/utils/background_tasks.py) file implements job queuing using RQ, which integrates with Python 3.13's improved async ecosystem:

```python
from rq import Queue
from redis import Redis

redis_conn = Redis.from_url("redis://localhost:6379/0")
task_queue = Queue(connection=redis_conn)

def generate_metadata(game_id: int) -> None:
    """Heavy-weight metadata fetch that runs in the background."""
    # …implementation omitted…

# Enqueue the task

task_queue.enqueue(generate_metadata, game_id=42)

```

### Socket.IO Event Handlers

Real-time communication in [`backend/utils/socket.py`](https://github.com/rommapp/romm/blob/main/backend/utils/socket.py) leverages Python 3.13's enhanced asyncio for WebSocket management:

```python
import socketio

sio = socketio.AsyncServer(async_mode="asgi")
app = socketio.ASGIApp(sio)

@sio.event
async def connect(sid, environ):
    print(f"Client {sid} connected")

@sio.event
async def disconnect(sid):
    print(f"Client {sid} disconnected")

```

## Key Files Affected by the Python Version Constraint

Several critical backend files depend on the Python 3.13+ runtime environment:

- **`uv.lock`**: The dependency lock file that pins the `requires-python = ">=3.13"` constraint and ensures reproducible builds.
- **[`backend/main.py`](https://github.com/rommapp/romm/blob/main/backend/main.py)**: The FastAPI application entry point that initializes the async server and depends on modern asyncio features.
- **[`backend/utils/database.py`](https://github.com/rommapp/romm/blob/main/backend/utils/database.py)**: Handles database session management using SQLAlchemy 2.0, which requires recent Python typing support.
- **[`backend/utils/background_tasks.py`](https://github.com/rommapp/romm/blob/main/backend/utils/background_tasks.py)**: Manages background job queuing via Redis RQ, relying on Python 3.13's improved error handling.
- **[`backend/utils/socket.py`](https://github.com/rommapp/romm/blob/main/backend/utils/socket.py)**: Sets up the Socket.IO server for real-time communication, benefiting from enhanced async task scheduling.

## Summary

- RomM's backend **requires Python 3.13 or newer**, as defined in the `uv.lock` file with `requires-python = ">=3.13"`.
- The requirement ensures compatibility with **FastAPI**, **SQLAlchemy 2.0**, **Redis RQ**, and **Socket.IO**.
- Python 3.13 provides necessary **asyncio enhancements**, **typing improvements**, and **diagnostic capabilities** that the backend relies on.
- Key files including [`backend/main.py`](https://github.com/rommapp/romm/blob/main/backend/main.py), [`backend/utils/database.py`](https://github.com/rommapp/romm/blob/main/backend/utils/database.py), and [`backend/utils/socket.py`](https://github.com/rommapp/romm/blob/main/backend/utils/socket.py) utilize these modern Python features.

## Frequently Asked Questions

### What is the minimum Python version required for RomM backend?

RomM requires **Python 3.13 or newer**. This is explicitly declared in the `uv.lock` dependency lock file with the constraint `requires-python = ">=3.13"`. Attempting to run the backend on older versions will result in dependency resolution failures or runtime errors.

### Can I run RomM backend on Python 3.12 or older versions?

No. While some individual code patterns might function on Python 3.10 or 3.11, RomM officially requires Python 3.13. The `uv.lock` file enforces this constraint, and the backend relies on Python 3.13-specific optimizations in `asyncio`, `typing`, and error handling that are not available in earlier versions.

### Where is the Python version requirement specified in the RomM repository?

The Python version requirement is specified in the **`uv.lock`** file in the repository root. This file contains the line `requires-python = ">=3.13"`, which the `uv` package manager uses to ensure the correct runtime environment during installation and deployment.

### Why does RomM specifically require Python 3.13 instead of 3.11 or 3.12?

Python 3.13 introduces **enhanced asyncio capabilities** for better task scheduling, **updated typing constructs** that simplify complex API schemas with Pydantic and SQLAlchemy 2.0, and **improved error handling** that aids in debugging distributed services like Redis and RQ. These features provide the performance and developer experience standards required for RomM's architecture.