Skip to content

Utils

The utils layer lives in website/utils/ and provides helper functions shared across the application.

Overview

Module Description
form_parsers Extract classification scores, ambience, and restriction tags from Flask forms
game_embeds Build Discord embed dictionaries for announcements, sessions, registrations, and alerts
game_filters Paginated game search with multi-checkbox filters and status-based visibility rules
logger Request-aware logging with trace IDs and game event convenience wrapper

API Reference

Utility modules for logging, filters, and helpers.

get_app_version()

Return the application version.

Reads the version from the installed package metadata (pyproject.toml), falling back to the TAG environment variable (set by docker-compose).

Returns:

Type Description
str

The application version string, or 'dev' if neither source is available.

Source code in website/utils/__init__.py
def get_app_version() -> str:
    """Return the application version.

    Reads the version from the installed package metadata (pyproject.toml),
    falling back to the TAG environment variable (set by docker-compose).

    Returns:
        The application version string, or 'dev' if neither source is available.
    """
    try:
        return version("questmaster")
    except Exception:
        pass
    tag = os.environ.get("TAG")
    if tag:
        return tag
    return "dev"