Makefile
The Makefile in the project folder gives a short name to each of nine commands: training, the two test suites, the local API, the web app, the MLflow screen, the docs preview, and the two Docker images. For each one, this page gives its purpose, the exact command it runs, what it needs first, what it writes, and what you should see. Run every command from the project folder.
Which Command Do I Use?
| Command | What it is for | Address | Stops by itself? |
|---|---|---|---|
make train |
Train the model and log the run | none | Yes, in under a minute |
make pytest |
Run every Python test | none | Yes, in about 45 seconds |
make web-test |
Run the web app's tests | none | Yes, in a few seconds |
make start |
Run the prediction API on this computer | http://127.0.0.1:8000 |
No, press Ctrl+C |
make start-web |
Run the web app's dev server | http://localhost:5173 |
No, press Ctrl+C |
make start-web-ml |
Open the MLflow screen | http://127.0.0.1:5001 |
No, press Ctrl+C |
make docs |
Preview this docs site | http://127.0.0.1:8001 |
No, press Ctrl+C |
make docker-train |
Train inside a Docker container | none | Yes, in about a minute the first time |
make docker-serve |
Run the prediction API inside a Docker container | http://127.0.0.1:8000 |
No, press Ctrl+C |
What Must Be Set Up First?
- The Python environment. The Python commands run
.venv/bin/python, so create.venv/with Python 3.13 and install the pinned packages once:
python3.13 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
- The web app's packages.
make web-testandmake start-webneedfrontend/node_modules/. Install them once with Node.js 22.12 or later, using the exact versions inpackage-lock.json. Run this insidefrontend/:
npm ci
- MkDocs, for
make docsonly. It is not one of the project's Python packages, so the command uses themkdocson your PATH. Install it once with the versions the docs workflow uses:
pip install mkdocs==1.6.1 mkdocs-material==9.7.7 pymdown-extensions==12.0.1
- Docker Desktop, running, for the two Docker commands only.
Changing the Python or npm Program
Two settings at the top of the Makefile name the programs used: PYTHON (default .venv/bin/python) and NPM (default npm). Either can be changed for one run, for example:
make pytest PYTHON=python3.13
make train
What it is for: one training run. It fits the model on the training seasons, scores it, saves it, records the run in MLflow, and adds the run to the committed log in mlflow-reference/. Use it after changing a setting in config/config.yaml, after downloading new data, or before make start on a fresh copy of the repository.
- Runs:
MLFLOW_DISABLE_AGENT_HINT=1 .venv/bin/python -m src.model.train. The setting turns off a hint line MLflow prints that is not about this project. - Needs: the downloaded table
data/from-s3/nfl_matchups_2020_2026.csv, which is committed, andconfig/config.yaml. - Writes:
models/model.joblib, the model the API loads (git-ignored)mlflow.dbandmlartifacts/, MLflow's own record of the run (git-ignored)results/run-summary.json, the committed summary of settings, scores, and weights. Its bytes change only when the settings, the data, or the scores change.mlflow-reference/: the last run moves intoprevious-runs/, the new run is written tolatest-run/, andrun-history.mdandrun-history.jsongain a row. These files change on every run, so commit them with the code.
- What you see: the scores, ending with
saved: mlflow-reference/latest-run. The expected lines are in Step 2: Train the Model. Validation accuracy is 63.10% and test accuracy 59.06%. - If the table is missing or a check fails, it stops with one short message and writes nothing more.
- More: How Do I Do a Training Run?.
make pytest
What it is for: checking that the Python code still works after a change. It runs every test in tests/.
- Runs:
.venv/bin/python -m pytest, with the settings inpytest.ini. - Needs: nothing else. The tests use made-up data and stand-ins for S3, DynamoDB, and the model, so they need no AWS account and no internet.
- Writes: nothing in the project. Tests that write files use a temporary folder.
- What you see: 95 passed once a model has been trained. Without
models/model.joblib, for example on a fresh copy, 93 passed and 2 skipped: the last test intests/test_api.pyand the last intests/test_lambda_handler.pyneed the saved model. - To run one file:
.venv/bin/python -m pytest tests/test_features.py. - On GitHub: the Test Python workflow runs this same command on every pull request. See How Are the Python Tests Run?.
make web-test
What it is for: checking the web app's code: the matchup math, the schedule labels, the team table, the feedback check, the tabs, and each page.
- Runs:
npm testinsidefrontend/, which runsvitest runonce and exits. - Needs:
frontend/node_modules/(see What Must Be Set Up First?). - Writes: nothing in the project, except the two every-game checks below.
- What you see: 65 passed in 12 test files. On a fresh copy, 63 passed and 2 skipped:
matchups.parity.test.tsandseason.parity.test.tscompare the browser's numbers with expected files in the git-ignoredbuild/folder, and skip when those files are missing. When they run, they writebuild/js-bodies.jsonandbuild/season-bodies.json.
make start
What it is for: running the prediction API on this computer, to try requests with curl or to give make start-web an API to call.
- Runs:
.venv/bin/python -m uvicorn src.api.app:app --port 8000. uvicorn listens on127.0.0.1by default, so only this computer can reach it. - Needs:
models/model.joblib. Without it the service stops at start-up with "No saved model at models/model.joblib. Run python -m src.model.train first." Runmake trainonce. - Port 8000 must be free.
make docker-serveand a plainmkdocs servealso use it. - Addresses:
POST /predict,GET /health, and FastAPI's test page athttp://127.0.0.1:8000/docs./has no page and returns 404. - What you see:
Uvicorn running on http://127.0.0.1:8000, then one line per request. - Try it: How Do I Ask for a Prediction?. The worked example returns a home win probability of 0.3296.
make start-web
What it is for: working on the web app. The page reloads as soon as a file in frontend/src/ is saved.
- Runs:
npm run devinsidefrontend/, which starts Vite's dev server. - Needs:
frontend/node_modules/. For predictions, it also needs the API frommake startrunning in another terminal. Without it, the page loads but every Analyze shows an error message. - Address:
http://localhost:5173. The port is fixed (strictPortinvite.config.ts): the live API's CORS list allows only this local address, so Vite stops instead of moving to another port when 5173 is taken. - How it reaches the API: the page calls its own address, and Vite forwards
/predict,/health, and/feedbacktohttp://127.0.0.1:8000. To forward to another address, setAPI_PROXY_TARGETbefore the command. - The Feedback tab does not work locally. The local API has no
/feedbackroute, so sending the form gets status 404. The route exists only on AWS. See the feedback route section of Frontend and Backend Connection. - More: How Do I Run It Locally?.
make start-web-ml
What it is for: browsing training runs in MLflow's own screen: each run's 15 settings, 8 scores, saved files, and logged model, with charts to compare runs.
- Runs:
MLFLOW_DISABLE_AGENT_HINT=1 .venv/bin/python -m mlflow ui --backend-store-uri sqlite:///mlflow.db --host 127.0.0.1 --port 5001. - Address:
http://127.0.0.1:5001. Port 5001, because macOS Control Center often holds MLflow's default, 5000. - Needs:
mlflow.db, made by the firstmake train. Without it, MLflow makes an empty database and the screen shows only its emptyDefaultexperiment. - What you see: the list of experiments. Open
nfl-pregame-winner-v1to see the runs.Defaultis created by MLflow in every database and is never used. - It shows only this computer's runs.
mlflow.dbis git-ignored, so another copy of the repository shows only its own runs. The record every copy shares ismlflow-reference/. - Expected warnings: MLflow starts four worker processes, and each prints a
StarletteDeprecationWarningabout MLflow's own code. They are harmless.
make docs
What it is for: previewing this docs site while editing it. The page reloads when a file in docs/ or mkdocs.yml is saved.
- Runs:
mkdocs serve -a 127.0.0.1:8001. - Needs: MkDocs on your PATH (see What Must Be Set Up First?).
- Address:
http://127.0.0.1:8001, which redirects tohttp://127.0.0.1:8001/510-m3-nfl-prediction-analytics/, the same path as the published site (set bysite_urlinmkdocs.yml). Port 8001, because MkDocs' default, 8000, is the API's port. - Note: the preview prints a broken link as a warning and keeps running. The published build stops on one. Before committing docs, run
mkdocs build --strict, the same check the docs workflow runs.
make docker-train
What it is for: checking that the project trains the same way inside a container, with its own Python and packages, as on this computer.
- Runs four steps:
mkdir -p build/docker/resultschmod a+rwx build/docker/results, because the container runs as user 10001, and on Linux the mounted folder keeps this computer's permissions.docker build --target train -t 510-m3-nfl-train .docker run --rm -v "$(CURDIR)/build/docker/results:/app/results" 510-m3-nfl-train
- Needs: Docker Desktop, running. No AWS account, no virtual environment, and no trained model.
- Writes: only
build/docker/results/run-summary.jsonon this computer, through the mounted folder. Everything else the container writes (its model, MLflow database, and run log) is deleted with the container. Yourmlflow.db,models/, andmlflow-reference/are not touched. - What you see: the first build takes about a minute, most of it installing packages. Later builds take under a second unless
requirements.txtchanged. Then the same scores asmake train, three warnings thatgitis not in the image (expected), andsaved: mlflow-reference/latest-runinside the container. - Check it:
build/docker/results/run-summary.jsonshould be byte for byteresults/run-summary.json. See Check That It Matches the Project.
make docker-serve
What it is for: running the prediction API from a container, to check that the packaged project answers the same as the local one.
- Runs two steps:
docker build --target serve -t 510-m3-nfl-serve .. The build trains the model once, so the image carries its ownmodels/model.joblib.docker run --rm -p 127.0.0.1:8000:8000 510-m3-nfl-serve
- Needs: Docker Desktop, running, and port 8000 free, so stop
make startfirst. - Address:
http://127.0.0.1:8000, the same addresses asmake start. Docker publishes the port on127.0.0.1only. - What you see:
Uvicorn running on http://0.0.0.0:8000. That address is inside the container. Requests show as coming from172.17.0.1, Docker's address for this computer. See What the Output Means. - To stop it: press Ctrl+C. Uvicorn prints
Shutting down, and--rmremoves the container.
What Is Not a Make Command?
These are run rarely, so they stay as plain commands in their phase's Development Guide section:
- Rebuilding the web app's data files from the downloaded table:
python -m src.profilesandpython -m src.season. See Phase 5, Development Guide. - The web app's production build:
npm run buildinfrontend/. See How Do I Build and Preview the Site?. - The data pipeline's four steps (download, clean, upload to S3, download back). See Phase 1, Development Guide.
- Adding older MLflow runs to the log:
python -m src.model.export_mlflow --backfill. - Deploying to AWS. See Deploy the API and Deploy the Web App.