Add Python Version
Overview
Add one supported Python minor version to the numerai-predict Docker, test, and deployment matrix. Keep the implementation aligned with the latest existing py3.* directory and make every changed line trace to the new version.
Inputs
Use these tokens consistently:
3.XX: dotted Python version, such as 3.14.
3_XX: underscore Python version, such as 3_14.
py3.XX: version directory name.
3.YY: next Python minor version for the upper requires-python bound.
Discover the current supported versions by listing py3.* directories and checking .github/workflows/test-all.yaml.
Workflow
Verify the target Python version is viable before editing.
Confirm that python:3.XX-slim exists and that core ML dependencies are available for the target version. Pay particular attention to TensorFlow, PyTorch, JAX, XGBoost, LightGBM, CatBoost, pandas, NumPy, SciPy, scikit-learn, numerapi, numerai-tools, and numerblox.
Create py3.XX/.
Copy the newest existing py3.* directory, then update:
Dockerfile: replace the base image with FROM python:3.XX-slim and update any copied paths to py3.XX.
pyproject.toml: set name = "py3-XX" and requires-python = ">=3.XX,<3.YY".
- Dependencies: adjust only versions needed for Python compatibility.
Regenerate dependency artifacts.
Run from the new version directory:
poetry lock
poetry export -f requirements.txt --without-hashes --output requirements.txt
sed -i '' 's/; .*$//g' requirements.txt
On Linux, use:
sed -i 's/; .*$//g' requirements.txt
Update Makefile.
Copy the latest existing version-specific targets and replace the version tokens. Add the new target names to the aggregate build, test, push_latest, and push_stable targets.
Required targets:
build_3_XX
test_3_XX
push_latest_3_XX
push_stable_3_XX
Update GitHub workflow matrices.
Add 3_XX to .github/workflows/test-all.yaml.
Add 3{0}XX to every Python-version matrix in:
.github/workflows/deploy-images.yml
.github/workflows/deploy-stable.yaml
Create test pickle models.
Generate both files with the target Python version:
tests/models/model_3_XX.pkl: two-argument predict function, predict(live_features, benchmark_models).
tests/models/model_3_XX_legacy.pkl: one-argument predict function, predict(live_features).
Prefer the repository helper when notebooks are available:
python3.XX tests/generate_pkl.py --version py3.XX --notebook-path /path/to/example_model.ipynb
python3.XX tests/generate_pkl.py --version py3.XX --notebook-path /path/to/legacy_model.ipynb --legacy
If creating simple fixtures manually, ensure the pickle can be loaded by the target container and returns a pandas DataFrame with a prediction column.
Update README.md.
Keep examples on the latest supported version:
make build_3_XX
docker run -i --rm -v "$PWD:$PWD" ghcr.io/numerai/numerai_predict_py_3_XX:stable --debug --model $PWD/model.pkl
Test locally.
Run:
make build_3_XX
make test_3_XX
If the change touches shared logic, also run:
make test
Verification Checklist
py3.XX/Dockerfile exists and uses python:3.XX-slim.
py3.XX/pyproject.toml has the correct project name and Python constraint.
py3.XX/poetry.lock was generated successfully.
py3.XX/requirements.txt was generated from Poetry export.
Makefile includes the four version-specific targets and all aggregate target references.
.github/workflows/test-all.yaml includes 3_XX.
.github/workflows/deploy-images.yml includes 3{0}XX in all Python-version matrices.
.github/workflows/deploy-stable.yaml includes 3{0}XX in all Python-version matrices.
- Both new test pickle files exist.
README.md examples use the latest supported version.
make build_3_XX succeeds.
make test_3_XX succeeds.
Troubleshooting
- If Poetry cannot resolve dependencies, identify the package that lacks target-version support, then prefer compatible newer versions before loosening constraints.
- If Docker fails during
poetry install, confirm the lock file was generated for the target Python version and that Linux wheels exist for compiled packages.
- If tests fail with pickle errors, recreate the test pickle files with the exact target Python version.
1---2name: add-python-version3description: Add support for a new Python version in numerai-predict by creating py3.x container files, updating Makefile and GitHub workflow matrices, generating lock and requirements files, creating versioned test pickle models, updating README examples, and running version-specific Docker tests. Use when asked to add, upgrade, or onboard a supported Python runtime for Numerai prediction images.4---56# Add Python Version78## Overview910Add one supported Python minor version to the numerai-predict Docker, test, and deployment matrix. Keep the implementation aligned with the latest existing `py3.*` directory and make every changed line trace to the new version.1112## Inputs1314Use these tokens consistently:1516- `3.XX`: dotted Python version, such as `3.14`.17- `3_XX`: underscore Python version, such as `3_14`.18- `py3.XX`: version directory name.19- `3.YY`: next Python minor version for the upper `requires-python` bound.2021Discover the current supported versions by listing `py3.*` directories and checking `.github/workflows/test-all.yaml`.2223## Workflow24251. Verify the target Python version is viable before editing.2627 Confirm that `python:3.XX-slim` exists and that core ML dependencies are available for the target version. Pay particular attention to TensorFlow, PyTorch, JAX, XGBoost, LightGBM, CatBoost, pandas, NumPy, SciPy, scikit-learn, `numerapi`, `numerai-tools`, and `numerblox`.28292. Create `py3.XX/`.3031 Copy the newest existing `py3.*` directory, then update:3233 - `Dockerfile`: replace the base image with `FROM python:3.XX-slim` and update any copied paths to `py3.XX`.34 - `pyproject.toml`: set `name = "py3-XX"` and `requires-python = ">=3.XX,<3.YY"`.35 - Dependencies: adjust only versions needed for Python compatibility.36373. Regenerate dependency artifacts.3839 Run from the new version directory:4041 ```bash42 poetry lock43 poetry export -f requirements.txt --without-hashes --output requirements.txt44 sed -i '' 's/; .*$//g' requirements.txt45 ```4647 On Linux, use:4849 ```bash50 sed -i 's/; .*$//g' requirements.txt51 ```52534. Update `Makefile`.5455 Copy the latest existing version-specific targets and replace the version tokens. Add the new target names to the aggregate `build`, `test`, `push_latest`, and `push_stable` targets.5657 Required targets:5859 ```makefile60 build_3_XX61 test_3_XX62 push_latest_3_XX63 push_stable_3_XX64 ```65665. Update GitHub workflow matrices.6768 Add `3_XX` to `.github/workflows/test-all.yaml`.6970 Add `3{0}XX` to every Python-version matrix in:7172 - `.github/workflows/deploy-images.yml`73 - `.github/workflows/deploy-stable.yaml`74756. Create test pickle models.7677 Generate both files with the target Python version:7879 - `tests/models/model_3_XX.pkl`: two-argument predict function, `predict(live_features, benchmark_models)`.80 - `tests/models/model_3_XX_legacy.pkl`: one-argument predict function, `predict(live_features)`.8182 Prefer the repository helper when notebooks are available:8384 ```bash85 python3.XX tests/generate_pkl.py --version py3.XX --notebook-path /path/to/example_model.ipynb86 python3.XX tests/generate_pkl.py --version py3.XX --notebook-path /path/to/legacy_model.ipynb --legacy87 ```8889 If creating simple fixtures manually, ensure the pickle can be loaded by the target container and returns a pandas DataFrame with a `prediction` column.90917. Update `README.md`.9293 Keep examples on the latest supported version:9495 ```bash96 make build_3_XX97 docker run -i --rm -v "$PWD:$PWD" ghcr.io/numerai/numerai_predict_py_3_XX:stable --debug --model $PWD/model.pkl98 ```991008. Test locally.101102 Run:103104 ```bash105 make build_3_XX106 make test_3_XX107 ```108109 If the change touches shared logic, also run:110111 ```bash112 make test113 ```114115## Verification Checklist116117- `py3.XX/Dockerfile` exists and uses `python:3.XX-slim`.118- `py3.XX/pyproject.toml` has the correct project name and Python constraint.119- `py3.XX/poetry.lock` was generated successfully.120- `py3.XX/requirements.txt` was generated from Poetry export.121- `Makefile` includes the four version-specific targets and all aggregate target references.122- `.github/workflows/test-all.yaml` includes `3_XX`.123- `.github/workflows/deploy-images.yml` includes `3{0}XX` in all Python-version matrices.124- `.github/workflows/deploy-stable.yaml` includes `3{0}XX` in all Python-version matrices.125- Both new test pickle files exist.126- `README.md` examples use the latest supported version.127- `make build_3_XX` succeeds.128- `make test_3_XX` succeeds.129130## Troubleshooting131132- If Poetry cannot resolve dependencies, identify the package that lacks target-version support, then prefer compatible newer versions before loosening constraints.133- If Docker fails during `poetry install`, confirm the lock file was generated for the target Python version and that Linux wheels exist for compiled packages.134- If tests fail with pickle errors, recreate the test pickle files with the exact target Python version.