korb 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
korb-0.1.0/.coverage ADDED
Binary file
@@ -0,0 +1,47 @@
1
+ name: Release & Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ release:
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v6
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ - name: Verify tag matches package version
30
+ run: |
31
+ TAG="${GITHUB_REF#refs/tags/v}"
32
+ PKG=$(uv run python -c "import korb; print(korb.__version__)")
33
+ if [ "$TAG" != "$PKG" ]; then
34
+ echo "::error::Tag v$TAG does not match __version__ $PKG"
35
+ exit 1
36
+ fi
37
+
38
+ - name: Create GitHub Release
39
+ uses: softprops/action-gh-release@v2
40
+ with:
41
+ generate_release_notes: true
42
+
43
+ - name: Build package
44
+ run: uv build
45
+
46
+ - name: Publish to PyPI
47
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,30 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
20
+
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v6
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Install dependencies
27
+ run: uv sync --group dev
28
+
29
+ - name: Run tests
30
+ run: uv run pytest -v --tb=short
korb-0.1.0/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+
9
+ # Lock file
10
+ uv.lock
11
+
12
+ # Downloaded HTML data (keep folders via .gitkeep)
13
+ files/**/*.html
14
+
15
+ # OS
16
+ .DS_Store
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/).
6
+
7
+ ## [0.1.0] — 2026-04-08
8
+
9
+ ### Added
10
+
11
+ - `standings` command — full league table with points, differentials, averages.
12
+ - `team` command — game-by-game results, sparklines, bar chart, quality metrics.
13
+ - `schedule` command — schedule viewer with back-to-back detection, pending/team filters.
14
+ - `predict` command — multiplicative efficiency model for final standings forecast.
15
+ - `top` command — quick leaderboard with ASCII bar chart.
16
+ - `download` command — fetch HTML data from basketball-bund.net.
17
+ - `--json` flag for machine-readable output on all commands.
18
+ - `--version` flag.
korb-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Malvavisc0
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
korb-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,342 @@
1
+ Metadata-Version: 2.4
2
+ Name: korb
3
+ Version: 0.1.0
4
+ Summary: A CLI toolkit for DBB basketball league analysis
5
+ Project-URL: Homepage, https://github.com/malvavisc0/korb
6
+ Project-URL: Repository, https://github.com/malvavisc0/korb
7
+ Project-URL: Issues, https://github.com/malvavisc0/korb/issues
8
+ Author-email: Malvavisc0 <207609879+malvavisc0@users.noreply.github.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: basketball,cli,dbb,german-basketball,sports-analytics
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+
26
+ <p align="center">
27
+ <strong>🏀 korb</strong><br>
28
+ <em>A CLI toolkit for DBB basketball league analysis</em>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <img src="https://img.shields.io/badge/python-3.10%2B-blue?logo=python&amp;logoColor=white" alt="Python 3.10+">
33
+ <img src="https://img.shields.io/badge/uv-package%20manager-blueviolet?logo=uv" alt="uv">
34
+ <img src="https://img.shields.io/badge/deps-zero-brightgreen" alt="Zero dependencies">
35
+ <img src="https://img.shields.io/badge/platform-DBB%20JSP-orange" alt="DBB JSP">
36
+ </p>
37
+
38
+ ---
39
+
40
+ ## What is this?
41
+
42
+ A zero-dependency Python CLI that parses HTML from the **DBB** (Deutscher Basketball Bund) legacy JSP platform and gives you:
43
+
44
+ - 📊 **Standings** — full league table with points, differentials, averages
45
+ - 🏀 **Team drill-down** — game-by-game results, sparklines, quality metrics
46
+ - 📅 **Schedule** — with back-to-back detection, filtering, pending games
47
+ - 🔮 **Predictions** — efficiency-model-based final standings forecast
48
+ - 🥇 **Top N** — quick leaderboard with ASCII bar chart
49
+ - 📥 **Download** — fetch fresh HTML data directly from basketball-bund.net
50
+ - 🔧 **JSON output** — pipe-friendly `--json` flag for all commands
51
+
52
+ ---
53
+
54
+ ## Quick Start
55
+
56
+ ```bash
57
+ # Install with uv
58
+ uv sync
59
+
60
+ # Download league data (liga_id from the DBB URL)
61
+ uv run korb download 12345
62
+
63
+ # View standings
64
+ uv run korb standings --liganr 12345
65
+
66
+ # Predict the rest of the season
67
+ uv run korb predict --liganr 12345
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Installation
73
+
74
+ ```bash
75
+ # Clone and install
76
+ git clone https://github.com/malvavisc0/korb && cd korb
77
+ uv sync
78
+
79
+ # Install with dev tools (black, isort)
80
+ uv sync --group dev
81
+ ```
82
+
83
+ After `uv sync`, the `korb` CLI is available inside the virtual environment. Use `uv run korb` to invoke it, or activate the venv with `source .venv/bin/activate` and run `korb` directly.
84
+
85
+ ---
86
+
87
+ ## Commands
88
+
89
+ ### `download` — Fetch HTML data
90
+
91
+ ```bash
92
+ # Download results + schedule for a league
93
+ uv run korb download 12345
94
+ ```
95
+
96
+ Saves `ergebnisse.html` and `spielplan.html` into `files/<liganr>/`.
97
+
98
+ ### `standings` — League table
99
+
100
+ ```bash
101
+ uv run korb standings --liganr 12345
102
+ ```
103
+
104
+ ```
105
+ # Team GP W L D PF PA Diff Pts Avg PF Avg PA
106
+ ----------------------------------------------------------------------------------
107
+ 1 Thunder Academy 12 9 3 0 1248 847 +401 18 104.0 70.6
108
+ 2 Riverside Hawks 11 9 2 0 952 668 +284 18 86.5 60.7
109
+ 3 Metro Wolves 11 8 3 0 813 694 +119 16 73.9 63.1
110
+ ...
111
+ ```
112
+
113
+ ### `team` — Deep dive on a single team
114
+
115
+ ```bash
116
+ # Basic results
117
+ uv run korb team "Thunder" --liganr 12345
118
+
119
+ # With bar chart + quality metrics for last 5 games
120
+ uv run korb team "Thunder" --bars --last-k 5 --metrics --liganr 12345
121
+ ```
122
+
123
+ ### `schedule` — Game calendar
124
+
125
+ ```bash
126
+ # All upcoming games
127
+ uv run korb schedule --pending --liganr 12345
128
+
129
+ # Filter by team + mark back-to-back ⚡ fixtures
130
+ uv run korb schedule --team "Hawks" --pending --b2b --liganr 12345
131
+
132
+ # Include cancelled games
133
+ uv run korb schedule --all --liganr 12345
134
+ ```
135
+
136
+ ### `predict` — Forecast final standings
137
+
138
+ ```bash
139
+ uv run korb predict --liganr 12345
140
+ ```
141
+
142
+ Uses a multiplicative efficiency model with recency weighting, recent form blending, home advantage, and back-to-back fatigue modelling.
143
+
144
+ ### `top` — Quick leaderboard
145
+
146
+ ```bash
147
+ uv run korb top -n 5 --liganr 12345
148
+ ```
149
+
150
+ ### `--json` — Machine-readable output
151
+
152
+ Add `--json` before any subcommand to get JSON instead of tables:
153
+
154
+ ```bash
155
+ uv run korb --json standings --liganr 12345
156
+ uv run korb --json team "Hawks" --liganr 12345
157
+ uv run korb --json schedule --pending --liganr 12345
158
+ uv run korb --json predict --liganr 12345
159
+ uv run korb --json top -n 3 --liganr 12345
160
+ ```
161
+
162
+ ---
163
+
164
+ ## CLI Reference
165
+
166
+ ```
167
+ $ uv run korb --help
168
+
169
+ usage: korb [-h] [--results RESULTS] [--json]
170
+ {standings,team,schedule,predict,top,download} ...
171
+
172
+ Basketball league analysis tools
173
+
174
+ positional arguments:
175
+ {standings,team,schedule,predict,top,download}
176
+ standings Display league standings
177
+ team Display results for a team
178
+ schedule Display game schedule
179
+ predict Predict final standings
180
+ top Show top teams from current standings
181
+ download Download results & schedule HTML
182
+
183
+ options:
184
+ -h, --help show this help message and exit
185
+ --results, -r RESULTS
186
+ HTML results file path (files/<liganr>/ergebnisse.html)
187
+ --json Output as JSON instead of formatted tables
188
+ ```
189
+
190
+ <details>
191
+ <summary><code>standings --help</code></summary>
192
+
193
+ ```
194
+ usage: korb standings [-h] [--liganr LIGANR]
195
+
196
+ options:
197
+ -h, --help show this help message and exit
198
+ --liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html
199
+ ```
200
+ </details>
201
+
202
+ <details>
203
+ <summary><code>team --help</code></summary>
204
+
205
+ ```
206
+ usage: korb team [-h] [--liganr LIGANR] [--bars] [--last-k LAST_K] [--metrics] name
207
+
208
+ positional arguments:
209
+ name Team name (e.g., 'Thunder Academy')
210
+
211
+ options:
212
+ -h, --help show this help message and exit
213
+ --liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html
214
+ --bars, -b Show point differential bar chart
215
+ --last-k LAST_K Analyze only the most recent K games (newest-first)
216
+ --metrics Show win-rate + margin quality metrics (respects --last-k)
217
+ ```
218
+ </details>
219
+
220
+ <details>
221
+ <summary><code>schedule --help</code></summary>
222
+
223
+ ```
224
+ usage: korb schedule [-h] [--html HTML] [--liganr LIGANR] [--all] [--pending] [--team TEAM] [--b2b]
225
+
226
+ options:
227
+ -h, --help show this help message and exit
228
+ --html HTML Schedule HTML file (files/<liganr>/spielplan.html)
229
+ --liganr LIGANR Liga ID; uses files/<liganr>/spielplan.html
230
+ --all, -a Show cancelled games
231
+ --pending, -p Show only pending games
232
+ --team, -t TEAM Filter by team name (partial match)
233
+ --b2b Mark fixtures that include a back-to-back (≤36h)
234
+ ```
235
+ </details>
236
+
237
+ <details>
238
+ <summary><code>predict --help</code></summary>
239
+
240
+ ```
241
+ usage: korb predict [-h] [--html HTML] [--liganr LIGANR]
242
+
243
+ options:
244
+ -h, --help show this help message and exit
245
+ --html HTML Schedule HTML file (files/<liganr>/spielplan.html)
246
+ --liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html + spielplan.html
247
+ ```
248
+ </details>
249
+
250
+ <details>
251
+ <summary><code>top --help</code></summary>
252
+
253
+ ```
254
+ usage: korb top [-h] [-n N] [--liganr LIGANR]
255
+
256
+ options:
257
+ -h, --help show this help message and exit
258
+ --liganr LIGANR Liga ID; uses files/<liganr>/ergebnisse.html
259
+ -n N How many teams to show (default: 3)
260
+ ```
261
+ </details>
262
+
263
+ <details>
264
+ <summary><code>download --help</code></summary>
265
+
266
+ ```
267
+ usage: korb download [-h] liganr
268
+
269
+ positional arguments:
270
+ liganr Liga ID (e.g. 12345)
271
+
272
+ options:
273
+ -h, --help show this help message and exit
274
+ ```
275
+ </details>
276
+
277
+ ---
278
+
279
+ ## How Predictions Work
280
+
281
+ The `predict` command estimates final standings using a **multiplicative efficiency model**:
282
+
283
+ | Factor | How it works |
284
+ |---|---|
285
+ | **Offensive rating** | Team's scored points vs. league average (>1.0 = above avg) |
286
+ | **Defensive rating** | Points allowed vs. league average (>1.0 = worse defense) |
287
+ | **Recency weighting** | 60-day half-life — recent games count more |
288
+ | **Recent form** | Last 5 games blended at 30% weight into ratings |
289
+ | **Home advantage** | 3% scoring boost applied symmetrically |
290
+ | **B2B fatigue** | ≤36h between games → 5% offense/defense penalty |
291
+ | **New teams** | <3 games → ratings blended toward league average |
292
+ | **No draws** | Ties broken by home advantage (basketball has OT) |
293
+ | **No double-counting** | Already-played games excluded from schedule scan |
294
+
295
+ ---
296
+
297
+ ## 🧠 Skills
298
+
299
+ The `skills/` directory contains **reusable AI skill definitions** — structured prompts that can be loaded by an AI assistant (e.g. Roo/Cline) to run analysis workflows using the CLI.
300
+
301
+ | Skill | Output | Description |
302
+ |---|---|---|
303
+ | [`SKILL_TEAM_ANALYSIS.md`](skills/SKILL_TEAM_ANALYSIS.md) | Paragraph | Short team summary (position, identity, form, outlook) — ready for a webpage card |
304
+ | [`SKILL_LEAGUE_TOP_N_ANALYSIS.md`](skills/SKILL_LEAGUE_TOP_N_ANALYSIS.md) | Table + paragraph | Predicted final standings table with a brief explanation |
305
+
306
+ Both skills accept a `LANGUAGE` parameter (`en`/`de`/`es`) and return output directly (no file saved). To use a skill, point your AI assistant at the markdown file or load it as a skill definition.
307
+
308
+ ---
309
+
310
+ ## Project Structure
311
+
312
+ ```
313
+ ├── korb/
314
+ │ ├── __init__.py # Package marker
315
+ │ ├── __main__.py # CLI entry point & download command
316
+ │ ├── core.py # Shared models, HTML parsing, utilities
317
+ │ ├── predict.py # Multiplicative efficiency prediction model
318
+ │ ├── schedule.py # HTML schedule parser & filters
319
+ │ ├── standings.py # Standings calculator
320
+ │ └── team.py # Team results viewer & metrics
321
+ ├── skills/ # AI skill definitions for automated analysis
322
+ ├── files/ # Downloaded HTML data (git-ignored)
323
+ ├── tests/ # Tests
324
+ ├── pyproject.toml # Project metadata & uv config
325
+ └── README.md
326
+ ```
327
+
328
+ **Requirements:** Python 3.10+ · [uv](https://docs.astral.sh/uv/) · No runtime dependencies
329
+
330
+ > **Note:** Downloaded HTML files and `--liganr` paths resolve relative to your
331
+ > current working directory (`files/<liganr>/`). Run `korb` from the project root
332
+ > or pass explicit `--results` / `--html` paths.
333
+
334
+ ### Dev tools
335
+
336
+ ```bash
337
+ # Format code
338
+ uv run black korb/
339
+
340
+ # Sort imports
341
+ uv run isort korb/
342
+ ```