Skip to content

Add one-command season bootstrap script for local database setup #59

Description

@Mattsface

Summary

Add a single operational script that prepares a local MLB Visualizer database for a season without requiring developers to remember multiple import commands.

Proposed command:

poetry run python scripts/bootstrap_season.py --season 2025

Motivation

Local setup currently requires separate commands for migrations, league ingestion, and player catalog ingestion. A bootstrap command would make it much easier to get a development database into a known usable state.

Proposed behavior

For the requested season, the script should:

  1. Apply Alembic migrations.
  2. Import the full league season using the existing league ingestion workflow.
  3. Import the player catalog for that season.
  4. Print a concise summary of what completed or failed.

The implementation should reuse the existing service-layer functions where possible rather than shelling out to the existing scripts.

Out of scope

Do not automatically import statistics for every individual player. The player catalog should be populated, while individual player-season statistics remain an explicit/on-demand import to avoid a large number of MLB API requests.

Acceptance criteria

  • New scripts/bootstrap_season.py entry point.
  • Supports --season <year>.
  • Runs database migrations before ingestion.
  • Performs league-wide season ingestion.
  • Imports the player catalog for the season.
  • Exits non-zero when a required bootstrap step fails.
  • Produces clear CLI output describing completed steps.
  • Has automated tests for orchestration/failure behavior without requiring live MLB network access.
  • README documents the bootstrap command as the preferred local database setup workflow.

Intended local workflow

poetry install
poetry run python scripts/bootstrap_season.py --season 2025
poetry run uvicorn app.main:app --reload

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions