Skip to content

Developing for FantasyRummyWars.com

Matt Urban edited this page Sep 26, 2026 · 11 revisions

If you're so inclined, feel free to suggest and add features to FantasyRummyWars.com!

codecov codecov

Installation

git clone https://github.com/urbanblight/rummy-wars/
cd rummy-wars
./scripts/setup.sh

Auto-generated documentation is available in docs/_build/html/.

Tests

Run the unit, HTTP integration, and browser suites separately by directory:

python3 -m pytest tests/unit
python3 -m pytest tests/integration
python3 -m pytest tests/browser

or run all of them together:

python3 -m pytest tests

The tests use the checked-in roster export and mock external MLB validation calls, so they do not require network access. Browser tests require the Chromium browser installed by Playwright.

Deploy local web UI for development

Environment variables

The application loads variables from a local .env file when one is present. Set these variables to configure roster validation and the web server:

Variable Description Default
MAX_MINORS Maximum number of players allowed in Minors slots. 0
MAX_MINORS_AB Maximum career MLB at-bats for a batter in a Minors slot. 0
MAX_MINORS_IP Maximum career MLB innings pitched for a pitcher in a Minors slot. 0
MAX_IL Maximum number of players allowed in Injured slots. 0
MAX_RESERVES Maximum number of players allowed in Reserve slots. 0
MODE Controls whether rule violations are reported as violations (offseason) or warnings (inseason). inseason

Example .env file:

MAX_MINORS=20
MAX_MINORS_AB=130
MAX_MINORS_IP=50
MAX_IL=8
MAX_RESERVES=7
MODE=offseason

Secrets

Create a .env.secrets file for local development with the following:

SECRET_KEY=replace-with-your-secret

Ensure .env and .env.secrets are populated as desired, and then, from within the activated virtual environment:

python3 -m src.app

The server listens on port 8080 by default. Set PORT to use another port for local development.

PORT=1234 python3 -m src.app

Then open http://127.0.0.1:8080 (or the port you configured) and upload a CBS roster export. Uploaded files are processed in memory and are not persisted.

Deploy to Production

FantasyRummyWars.com runs in production as a serverless service in Google Cloud. Follow instructions to install & authenticate with glcoud. You'll need to request permissions from the commissioners to have authorization to push to production.

Build and Deploy

Create a secret for production deployment on Google Cloud.

gcloud secrets create SECRET_KEY --data-file=- <<< "replace-with-your-secret"

Once .env is also filled with the desired values, build and deploy the Docker image to Google Cloud Run

./scripts/deploy.sh

Using the local CLI

  • Execute python3 -m src.main --csv path/to/export.csv

Sample Output

Console only outputs INFO but the rummy-wars.log file contains DEBUG level messages

2026-09-16 18:01:14 | INFO     | main | Successfully loaded 55 players.
2026-09-16 18:01:14 | INFO     | utils | Does not exceed MiLB roster limit: 20
2026-09-16 18:01:14 | INFO     | utils | Does not exceed IL roster limit: 8
2026-09-16 18:01:15 | DEBUG    | utils | Tyler Soderstrom is placed in an Injured slot and is on the IL
2026-09-16 18:01:16 | DEBUG    | utils | Shohei Ohtani is placed in an Injured slot and is on the IL
2026-09-16 18:01:16 | DEBUG    | utils | Shane Bieber is placed in an Injured slot and is on the IL
2026-09-16 18:01:17 | WARNING  | utils | Sam Bachman is placed in an Injured slot and was activated 2026-09-16
2026-09-16 18:01:18 | DEBUG    | utils | Carlos Estevez is placed in an Injured slot and is on the IL
2026-09-16 18:01:19 | DEBUG    | utils | Cody Ponce is placed in an Injured slot and is on the IL
2026-09-16 18:01:20 | DEBUG    | utils | A.J. Puk is placed in an Injured slot and is on the IL
2026-09-16 18:01:21 | DEBUG    | utils | Kirby Yates is placed in an Injured slot and is on the IL
2026-09-16 18:01:21 | DEBUG    | utils | Ike Irish is currently on an MiLB team.
2026-09-16 18:01:22 | DEBUG    | utils | Tre' Morgan is currently on an MiLB team.
2026-09-16 18:01:22 | DEBUG    | utils | Dauri Fernandez is currently on an MiLB team.
2026-09-16 18:01:23 | DEBUG    | utils | Mitch Voit is currently on an MiLB team.
2026-09-16 18:01:23 | DEBUG    | utils | Wehiwa Aloy is currently on an MiLB team.
2026-09-16 18:01:24 | DEBUG    | utils | Coy James is currently on an MiLB team.
2026-09-16 18:01:25 | WARNING  | utils | Anthony Volpe is in a Minors slot but has more than 130 AB (1911). Most recent call up was 2026-09-10
2026-09-16 18:01:26 | DEBUG    | utils | Jaden Fauske is currently on an MiLB team.
2026-09-16 18:01:26 | DEBUG    | utils | Nick Morabito All-Time MLB AB: 29
2026-09-16 18:01:27 | DEBUG    | utils | Paulino Santana is currently on an MiLB team.
2026-09-16 18:01:28 | DEBUG    | utils | Junior Perez is currently on an MiLB team.
2026-09-16 18:01:28 | DEBUG    | utils | Kevin Alvarez is currently on an MiLB team.
2026-09-16 18:01:28 | DEBUG    | utils | Josue Briceno is currently on an MiLB team.
2026-09-16 18:01:29 | DEBUG    | utils | Andrew Salas is currently on an MiLB team.
2026-09-16 18:01:30 | DEBUG    | utils | Unable to match CBS name 'Dorian Soto' to MLB player
2026-09-16 18:01:30 | DEBUG    | utils | Colby Thomas is currently on an MiLB team.
2026-09-16 18:01:31 | WARNING  | utils | Ryan Waldschmidt is in a Minors slot but has more than 130 AB (248). Most recent call up was 2026-07-10
2026-09-16 18:01:32 | DEBUG    | utils | Jett Williams is currently on an MiLB team.
2026-09-16 18:01:32 | DEBUG    | utils | Jake Bloss is currently on an MiLB team.
2026-09-16 18:01:33 | DEBUG    | utils | Kai-Wei Teng is currently on an MiLB team.
2026-09-16 18:01:33 | INFO     | main | Roster may be compliant with evaluated rules, but check any warnings above.