This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Run the application:
python run_ui.py
python run_ui.py --help # see all runtime optionsRun tests:
PYTHONPATH=. python tests/run_tests.pyType checking:
pyright # uses pyrightconfig.json (basic mode)Install dependencies:
pip install -r requirements.txtBuild and deploy documentation:
mkdocs gh-deploy --forceEDH Matchmaker manages Commander (EDH) Swiss-pairing tournaments with 4-player pods via a PyQt6 GUI.
-
src/interface.py— Abstract interfaces (IPlayer,ITournament,IPod,IRound,IPairingLogic,IStandingsExport,ITournamentConfiguration). All major components implement these.IHashableprovides UUID-based caching via a class-levelCACHEdict. -
src/core.py(~3500 lines) — All concrete implementations:Tournament: Orchestrates rounds, players, pairing, standings, JSON save/load, and export triggers.Player: Tracks results (wins/draws/losses/byes), ratings, pod/opponent history. Seat normalization accounts for global win-rate advantages by seat position (~24.7%, 19.3%, 16.7%, 14.6%).Pod: A game group (default 4 players, fallback 3).Round: Holds pods; usesIPairingLogicto create pairings.TournamentConfiguration: Scoring (win=5, bye=4, draw=1 by default), pod sizes, round count, top-cut thresholds, auto-export settings.StandingsExport/PodsExport: Multi-format output (plain text, CSV, JSON).Log: Event logging with severity levels for console and file output.TournamentAction: Decorator that auto-persists tournament state to JSON after each action.
-
src/pairing_logic/examples.py— Pairing algorithm implementations:CommonPairing: Shared utilities (evaluate_pod(),bye_matching(),assign_byes()).PairingRandom: Random pairing.PairingSnake: Swiss-style snake seeding (default).
-
src/discord_engine.py— Optional async Discord integration (DiscordPostersingleton) with background thread and message queue. Configured via environment variables (DISCORD_TOKEN,GUILD_ID,CHANNEL_ID). -
src/misc.py—Json2Obj(dict-to-object converter),generate_player_names()(Faker-based),timeitdecorator. -
run_ui.py— PyQt6 GUI entry point. Loads.uifiles fromui/. Key classes:UILog(decorator for status updates),PlayerListItem(color-coded list items).
run_ui.py (PyQt6 GUI)
└─ Tournament (core.py)
├─ Round → Pod → Player
├─ IPairingLogic (pairing_logic/examples.py)
├─ TournamentConfiguration → StandingsExport / PodsExport
└─ TournamentAction decorator → JSON persistence (logs/)
@TournamentAction.action()— wraps mutating Tournament methods; auto-saves state to JSON after each call.@StandingsExport.auto_export()/@PodsExport.auto_export()— triggers file/Discord/API export after standings change.@UILog.with_status()— updates the GUI log display after operations.- UUID caching —
IHashable.CACHEallowsO(1)object lookup by UUID across all cacheable types.
Tests use unittest. tests/blns.txt (Big List of Naughty Strings) is used for edge-case input testing. Performance benchmarks in test_performance.py are filtered out of normal test runs.
Pyright runs in basic mode. Several noisy checks are suppressed (reportUnusedCallResult, reportUnknownMemberType, reportUnknownVariableType, reportMissingTypeStubs). Use # pyright: ignore or cast() rather than disabling rules globally.
Use Google-style docstrings (required by MkDocs mkdocstrings auto-documentation).