Skip to main content

wraith-tdf-predictor 🚴💨

Who cracks the top 10 in July? Six seasons of ProCyclingStats results, a from-scratch model, and a Tissot fantasy team picked by exact knapsack — all in pure Python. No torch, no sklearn, no 200 MB wheel for a model with nine weights.

The 2026 hot take so far: Pogačar. Groundbreaking stuff.

What it does

  • Scrapes grand tours, one-week stage races, monuments and top classics (men's elite, 2021–2026) into SQLite
  • Clusters riders into archetypes with hand-rolled k-means
  • Predicts top-10 finishes with class-weighted logistic regression (test AUC ~0.89 — form really is everything in cycling)
  • Picks a 10-rider, 120-star Tissot fantasy team via 0/1 knapsack with cardinality, backtested leave-one-year-out against the hindsight-optimal team
  • Publishes a static predictions page (data.json) with per-stage teams, jersey picks, and pred-vs-actual grading during the Tour

Install

pip install wraith-tdf-predictor    # or: uv add wraith-tdf-predictor

Runtime dependencies: procyclingstats and cloudscraper. That's it. Python 3.12+.

Run it

From a clone:

git clone https://git.thomaspeoples.com/thomaspeoples/wraith-tdf-predictor.git
cd wraith-tdf-predictor
uv run poe setup      # deps, hooks, .env from template — once

uv run poe ingest     # scrape PCS -> data/raw/*.json (polite, cached)
uv run poe db         # load -> data/races.db (SQLite)
uv run poe model      # archetypes + top-10 model
uv run poe fantasy    # backtest + 2026 team pick
uv run poe publish    # data.json for the static predictions page
docker compose up -d  # browse the DB at :8080

uv run poe update     # daily during the Tour: ingest new stage if
                       # raced, retrain, republish -- no-op otherwise

Outputs land in data/: archetypes.json, model.json, and a printed team that will absolutely not win your league.

Configuration

Everything configurable lives in .env (copied from .env.example by poe setup, never committed):

Variable Default Purpose
DATA_DIR ./data Scraped data, SQLite DB, model outputs
WWW_DIR $DATA_DIR/www Where poe publish writes data.json
TISSOT_USER / TISSOT_PASS — Only for scraping the Tissot game yourself

Poe tasks load .env automatically; direct python -m runs want uv run --env-file .env ....

Where the data comes from (and how politely it's scraped): docs/SOURCES.md.

Hacking on it

uv run poe test         # pytest, coverage >80% enforced
uv run poe tidy         # ruff lint + format
uv run poe docs-serve   # MkDocs on :8000
uv run cz commit        # commits go through commitizen, no exceptions

Full workflow in CONTRIBUTING.md.

License

MIT — see LICENSE.

Metadata

Release files for wraith-tdf-predictor 0.13.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wraith-tdf-predictor 0.13.1
File Size Uploaded Provenance Actions
wraith_tdf_predictor-0.13.1.tar.gz 167.4 kB Without provenance Details for wraith_tdf_predictor-0.13.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wraith-tdf-predictor 0.13.1
File Interpreter ABI Platform Actions
wraith_tdf_predictor-0.13.1-py3-none-any.whl Python 3 none any Details for wraith_tdf_predictor-0.13.1-py3-none-any.whl

Total release size: 199.8 kB

Release files / wraith_tdf_predictor-0.13.1.tar.gz

Download URL wraith_tdf_predictor-0.13.1.tar.gz
Size 167.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d3f08d24b16eb326918683e334a08a859e152008bac62f832b8000b5fed97488
BLAKE2b-256 checksum
How to use checksums
c47f38d0229752c406d787c546d637f7765560440eca4a87ad35a0820b82a636
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wraith_tdf_predictor-0.13.1-py3-none-any.whl

Download URL wraith_tdf_predictor-0.13.1-py3-none-any.whl
Size 32.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ddf1e2bbbc6ebbfa5cc80f9898fc22b5b2f387d33d63f600bcf959648e711a9
BLAKE2b-256 checksum
How to use checksums
adb48bb77c797763e006dec2c9e2df574cc4816d288f595bee16b84a54d2946d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for wraith-tdf-predictor 0.13.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page