🏀 korb
A CLI toolkit for DBB basketball league analysis
korb is a zero-dependency Python CLI that parses HTML from the DBB (Deutscher Basketball Bund) legacy JSP platform and provides standings, results, schedules, predictions, and more.
Features
- 📊 Standings — full league table with points, differentials, averages
- 🏀 Team — game-by-game results, sparklines, quality metrics
- 📋 Ergebnisse — all completed game results with optional team filter
- 📅 Schedule — with back-to-back detection, filtering, pending games
- 🔮 Predict — opponent-adjusted final standings forecast with win probabilities
- 🥇 Top — quick leaderboard with ASCII bar chart
- 🧪 Backtest — chronological holdout metrics for the prediction model
- 📥 Download — fetch fresh HTML data directly from basketball-bund.net
- 🔧
--json— machine-readable output for data commands (notdownload)
Installation
# With uv (recommended)
git clone https://github.com/malvavisc0/korb && cd korb
uv sync
# With pip (end-user install)
pip install .
After installation, the korb CLI is available inside the virtual environment.
Use uv run korb to invoke it, or activate the venv first.
Quick Start
# Download league data
uv run korb --ligaid 51187 download
# View standings
uv run korb --ligaid 51187 standings
# Download fresh data + predict in one go
uv run korb --ligaid 51187 --download predict
Finding your Liga ID
The --ligaid value comes from the liga_id parameter in the DBB league URL:
https://www.basketball-bund.net/index.jsp?Action=103&liga_id=51187
^^^^^
this is your liga ID
Commands
download — Fetch HTML data
uv run korb --ligaid 12345 download
uv run korb download --all # refresh all previously downloaded leagues
Saves ergebnisse.html and spielplan.html into files/<ligaid>/.
standings — League table
uv run korb --ligaid 12345 standings
ergebnisse — Game results
uv run korb --ligaid 12345 ergebnisse
uv run korb --ligaid 12345 ergebnisse --team "Hawks"
team — Deep dive on a single team
uv run korb --ligaid 12345 team "Thunder"
uv run korb --ligaid 12345 team "Thunder" --bars --last-k 5 --metrics
schedule — Game calendar
uv run korb --ligaid 12345 schedule --pending
uv run korb --ligaid 12345 schedule --team "Hawks" --pending --b2b
predict — Forecast final standings
uv run korb --ligaid 12345 predict
uv run korb --ligaid 12345 --json predict
backtest — Evaluate the prediction model
uv run korb --ligaid 12345 backtest
uv run korb --ligaid 12345 backtest --min-train 10
Trains on each game's prior results only and reports winner accuracy, Brier score, score MAE, and score RMSE.
top — Quick leaderboard
uv run korb --ligaid 12345 top -n 5
Global flags
| Flag | Description |
|---|---|
--json |
Output as JSON instead of formatted tables |
--download, -d |
Fetch fresh data before running the command |
--ligaid, -l |
Liga ID (resolves file paths automatically) |
--results, -r |
Explicit path to HTML results file |
--schedule, -s |
Explicit path to HTML schedule file |
--version, -V |
Show version |
How Predictions Work
The predict command fits opponent-adjusted ratings and converts them
into a multiplicative efficiency model:
| Factor | How it works |
|---|---|
| Opponent adjustment | Weighted ridge regression on point differentials |
| Offensive rating | Adjusted scoring strength relative to league average (>1.0 = above avg) |
| Defensive rating | Adjusted points allowed relative to league average (>1.0 = worse defense) |
| Recency weighting | 60-day half-life — recent games count more |
| Recent form | Last 5 opponent-adjusted residuals blended at 30% weight |
| Regularization | Ridge shrinkage replaces the hard 3-game cutoff |
| Home advantage | Fitted from results with a 3% prior |
| Win probability | Normal margin model using fitted score volatility |
| B2B fatigue | ≤36h between games → 5% offense/defense penalty |
| No draws | The higher win probability decides ties |
| Backtest | backtest evaluates the model chronologically |
Data Notes
- DBB encodes forfeits as
20:0/0:20; korb counts them as completed games, awards the winner 2 points, and deducts 1 point from the loser. - Struck-through and cancelled rows are skipped.
Project Structure
korb/
├── __init__.py # Package marker & version
├── __main__.py # CLI entry point & command handlers
├── backtest.py # Chronological model evaluation
├── core.py # Shared models, HTML parsing, utilities
├── download.py # HTTP downloader, headers, rate limiting
├── ergebnisse.py # Game results viewer & filter
├── model.py # Opponent-adjusted ratings & score model
├── predict.py # Final standings orchestration & output
├── schedule.py # HTML schedule parser & filters
├── standings.py # Standings calculator
└── team.py # Team results viewer & metrics
Requirements: Python 3.10+ · uv · No runtime dependencies
Note: Downloaded HTML files and
--ligaidpaths resolve relative to your current working directory (files/<ligaid>/). Runkorbfrom the project root or pass explicit--results/--schedulepaths.
Development
# Install with dev tools
uv sync --group dev --locked
# Lint, format & type-check
uv run ruff check korb/ tests/
uv run ruff format korb/ tests/
uv run basedpyright korb
# Run tests
uv run pytest
Project conventions are documented in
docs/coding-standard.md.
License
Metadata
Release files for korb 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| korb-0.3.2.tar.gz | 84.7 kB | Without provenance | Details for korb-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| korb-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for korb-0.3.2-py3-none-any.whl |
Total release size: 116.3 kB
Release files / korb-0.3.2.tar.gz
| Download URL | korb-0.3.2.tar.gz |
|---|---|
| Size | 84.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0946113deab97c7cb4c0c0c57543e4257e625636b08ecf12bdbe2612bd219b3
|
|
BLAKE2b-256 checksum How to use checksums |
f5ab73f4d0a0a413a5c885c636a72b61571aed70d84ff627a85ebfe0c10bc4ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / korb-0.3.2-py3-none-any.whl
| Download URL | korb-0.3.2-py3-none-any.whl |
|---|---|
| Size | 31.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13389502fbfbb27d0069dba6c89729dd22b1aa90e542fb7c4da6cfcbf8a540a2
|
|
BLAKE2b-256 checksum How to use checksums |
3c57926c5fa330cf9eb39ac2c3353f41332360838925de4b3e914f8195ad5da4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for korb 0.3.2
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.