statline 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.
Files changed (35) hide show
  1. statline-0.1.0/LICENSE +28 -0
  2. statline-0.1.0/PKG-INFO +22 -0
  3. statline-0.1.0/README.md +174 -0
  4. statline-0.1.0/pyproject.toml +47 -0
  5. statline-0.1.0/setup.cfg +4 -0
  6. statline-0.1.0/statline/__init__.py +0 -0
  7. statline-0.1.0/statline/cli.py +664 -0
  8. statline-0.1.0/statline/core/__init__.py +0 -0
  9. statline-0.1.0/statline/core/adapters/__init__.py +120 -0
  10. statline-0.1.0/statline/core/adapters/compile.py +166 -0
  11. statline-0.1.0/statline/core/adapters/hooks.py +33 -0
  12. statline-0.1.0/statline/core/adapters/loader.py +103 -0
  13. statline-0.1.0/statline/core/adapters/registry.py +37 -0
  14. statline-0.1.0/statline/core/adapters/types.py +51 -0
  15. statline-0.1.0/statline/core/cache.py +164 -0
  16. statline-0.1.0/statline/core/calculator.py +363 -0
  17. statline-0.1.0/statline/core/db.py +127 -0
  18. statline-0.1.0/statline/core/guild_manager.py +183 -0
  19. statline-0.1.0/statline/core/models.py +189 -0
  20. statline-0.1.0/statline/core/normalization.py +52 -0
  21. statline-0.1.0/statline/core/scoring.py +371 -0
  22. statline-0.1.0/statline/core/setup_service.py +153 -0
  23. statline-0.1.0/statline/core/sheets_sync.py +237 -0
  24. statline-0.1.0/statline/core/weights.py +74 -0
  25. statline-0.1.0/statline/io/__init__.py +0 -0
  26. statline-0.1.0/statline/io/sheets.py +139 -0
  27. statline-0.1.0/statline/utils/config.py +47 -0
  28. statline-0.1.0/statline/utils/logging.py +61 -0
  29. statline-0.1.0/statline/utils/paths.py +30 -0
  30. statline-0.1.0/statline/utils/timing.py +27 -0
  31. statline-0.1.0/statline.egg-info/PKG-INFO +22 -0
  32. statline-0.1.0/statline.egg-info/SOURCES.txt +33 -0
  33. statline-0.1.0/statline.egg-info/dependency_links.txt +1 -0
  34. statline-0.1.0/statline.egg-info/requires.txt +21 -0
  35. statline-0.1.0/statline.egg-info/top_level.txt +1 -0
statline-0.1.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ StatLine – Weighted Player Scoring and Analytics
2
+ Copyright (C) 2025 StatLine LLC (in formation)
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as published
6
+ by the Free Software Foundation, either version 3 of the License, or
7
+ (at your option) any later version.
8
+
9
+ As an additional condition, you may not use the name “StatLine” or any
10
+ confusingly similar mark in connection with your distribution, hosting,
11
+ or marketing of this software without express written permission from
12
+ the copyright holder. This restriction is to protect the StatLine brand
13
+ and avoid confusion between official and unofficial versions.
14
+
15
+ This program is distributed in the hope that it will be useful,
16
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ GNU Affero General Public License for more details.
19
+
20
+ You should have received a copy of the GNU Affero General Public License
21
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
22
+
23
+ ---
24
+
25
+ Additional Terms (Trademark)
26
+
27
+ "StatLine" and associated logos are trademarks of StatLine LLC (in formation), trademark registration pending.
28
+ This license does not grant you any rights to use the StatLine name or branding without prior written permission, except for fair use when referring to the project. Any fork, derivative work, or public deployment must remove the StatLine trademark unless explicitly authorized under our Trademark Policy.
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.4
2
+ Name: statline
3
+ Version: 0.1.0
4
+ Requires-Python: <3.14,>=3.10
5
+ License-File: LICENSE
6
+ Requires-Dist: typer>=0.12
7
+ Requires-Dist: pyyaml>=6
8
+ Requires-Dist: typing-extensions>=4.7; python_version < "3.11"
9
+ Provides-Extra: sheets
10
+ Requires-Dist: gspread>=6.0.0; extra == "sheets"
11
+ Requires-Dist: google-auth>=2.0.0; extra == "sheets"
12
+ Provides-Extra: dev
13
+ Requires-Dist: pytest>=8.1; extra == "dev"
14
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
15
+ Requires-Dist: ruff>=0.5; extra == "dev"
16
+ Requires-Dist: mypy>=1.11; extra == "dev"
17
+ Requires-Dist: coverage>=7.5; extra == "dev"
18
+ Requires-Dist: hypothesis>=6.100; extra == "dev"
19
+ Requires-Dist: types-PyYAML; extra == "dev"
20
+ Provides-Extra: cli-pretty
21
+ Requires-Dist: rich>=13.0; extra == "cli-pretty"
22
+ Dynamic: license-file
@@ -0,0 +1,174 @@
1
+ # StatLine
2
+
3
+ **StatLine™ — weighted player scoring, efficiency modeling, and tooling.**
4
+
5
+ “StatLine” is a trademark of StatLine LLC (in formation), registration pending.
6
+ Source code is licensed under the GNU Affero General Public License v3 (see LICENSE).
7
+ Brand, name, and logo are not covered by the AGPL.
8
+
9
+ ---
10
+
11
+ ## What is StatLine?
12
+
13
+ StatLine is an adapter-driven analytics framework that:
14
+
15
+ - normalizes raw game stats,
16
+ - computes per-metric scores (with clamps, inversion, and ratios),
17
+ - aggregates into buckets and applies weight presets (e.g., pri),
18
+ - exposes a clean CLI and library API,
19
+ - optionally ingests Google Sheets and caches mapped rows.
20
+
21
+ Supported Python:
22
+
23
+ - **3.10 – 3.13** (tested in CI across Linux, macOS, Windows)
24
+
25
+ ---
26
+
27
+ ## Install
28
+
29
+ Base install:
30
+
31
+ ```bash
32
+ # pip
33
+ python -m venv .venv && source .venv/bin/activate # use .\.venv\Scripts\activate on Windows
34
+ pip install statline
35
+ ```
36
+
37
+ With extras:
38
+
39
+ ```bash
40
+ # Google Sheets ingestion
41
+ pip install "statline[sheets]"
42
+
43
+ # Developer tools (linters, types, tests)
44
+ pip install -e ".[dev]"
45
+ ```
46
+
47
+ ---
48
+
49
+ ## CLI Basics
50
+
51
+ StatLine installs a console script `statline`. You can also call the module directly.
52
+
53
+ ```bash
54
+ statline --help
55
+ python -m statline.cli --help
56
+ ```
57
+
58
+ ### Common commands
59
+
60
+ ```bash
61
+ # list bundled adapters
62
+ statline adapters
63
+
64
+ # interactive scoring REPL (banner + timing are enabled by default)
65
+ statline interactive
66
+
67
+ # score a file of rows (CSV or YAML understood by the adapter)
68
+ statline score --adapter example_game stats.csv
69
+
70
+ # write results to a CSV instead of stdout
71
+ statline score --adapter example_game stats.csv --out results.csv
72
+ ```
73
+
74
+ Subcommands:
75
+
76
+ - `adapters` — show available adapter keys & aliases
77
+ - `interactive` — guided prompts + timing table
78
+ - `export-csv` — export cached mapped metrics (when using the cache/Sheets flow)
79
+ - `score` — batch-score a CSV/YAML through an adapter
80
+
81
+ When the CLI runs, you’ll see a banner (noted so you can confirm proper install):
82
+
83
+ ```diff
84
+ === StatLine — Adapter-Driven Scoring ===
85
+ ```
86
+
87
+ Enable per-stage timing via env (eg: 14ms):
88
+
89
+ ```bash
90
+ STATLINE_TIMING=1 statline score --adapter rbw5 stats.csv
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Input formats
96
+
97
+ StatLine reads **CSV** or **YAML**. The columns/keys must match what the adapter expects.
98
+
99
+ ### CSV
100
+
101
+ - First row is the header.
102
+ - Each subsequent row is an entity (player).
103
+ - Provide whatever **raw** fields your adapter maps (e.g., `ppg, apg, fgm, fga, tov`).
104
+
105
+ ```cs
106
+ display_name,team,ppg,apg,orpg,drpg,spg,bpg,fgm,fga,tov
107
+ Jordan,Red,27.3,4.8,1.2,3.6,1.9,0.7,10.2,22.1,2.1
108
+ ```
109
+
110
+ ### Example adapter (yaml)
111
+
112
+ Adapters define the schema for raw inputs, buckets, weights, and any derived metrics.
113
+ Below is the `example.yaml` you can ship in `statline/core/adapters/defs/`:
114
+
115
+ ```yaml
116
+ key: example_game
117
+ version: 0.1.0
118
+ aliases: [ex, sample]
119
+ title: Example Game
120
+
121
+ dimensions:
122
+ map: { values: [MapA, MapB, MapC] }
123
+ side: { values: [Attack, Defense] }
124
+ role: { values: [Carry, Support, Flex] }
125
+ mode: { values: [Pro, Ranked, Scrim] }
126
+
127
+ buckets:
128
+ scoring: {}
129
+ impact: {}
130
+ utility: {}
131
+ survival: {}
132
+ discipline: {}
133
+
134
+ metrics:
135
+ # direct fields
136
+ - { key: stat3_count, bucket: utility, clamp: [0, 50], source: { field: stat3_count } }
137
+ - { key: mistakes, bucket: discipline, clamp: [0, 25], invert: true, source: { field: mistakes } }
138
+
139
+ # ratios/derived — replace old mapping math
140
+ efficiency:
141
+ - { key: stat1_per_round, make: raw["stat1_total"], attempt: raw["rounds_played"], bucket: scoring }
142
+ - { key: stat2_rate, make: raw["stat2_numer"], attempt: raw["stat2_denom"], bucket: impact }
143
+ - { key: stat4_quality, make: raw["stat4_good"], attempt: raw["stat4_total"], bucket: survival }
144
+
145
+ weights:
146
+ pri:
147
+ scoring: 0.30
148
+ impact: 0.28
149
+ utility: 0.16
150
+ survival: 0.16
151
+ discipline: 0.10
152
+ mvp:
153
+ scoring: 0.34
154
+ impact: 0.30
155
+ utility: 0.12
156
+ survival: 0.14
157
+ discipline: 0.10
158
+ support:
159
+ scoring: 0.16
160
+ impact: 0.18
161
+ utility: 0.40
162
+ survival: 0.16
163
+ discipline: 0.10
164
+
165
+ penalties:
166
+ pri: { discipline: 0.10 }
167
+ mvp: { discipline: 0.12 }
168
+ support: { discipline: 0.08 }
169
+
170
+ sniff:
171
+ require_any_headers: [stat1_total, stat2_numer, stat2_denom, rounds_played, mistakes]
172
+ ```
173
+
174
+ Reference `HOWTO.md` should you have any questions regarding adapters and yaml formatting.
@@ -0,0 +1,47 @@
1
+ [project]
2
+ name = "statline"
3
+ version = "0.1.0"
4
+ requires-python = ">=3.10,<3.14"
5
+ dependencies = [
6
+ "typer>=0.12",
7
+ "pyyaml>=6",
8
+ 'typing-extensions>=4.7; python_version < "3.11"',
9
+ ]
10
+
11
+ [project.optional-dependencies]
12
+ sheets = ["gspread>=6.0.0", "google-auth>=2.0.0"]
13
+ dev = [
14
+ "pytest>=8.1",
15
+ "pytest-cov>=4.1",
16
+ "ruff>=0.5",
17
+ "mypy>=1.11", # 3.13-friendly
18
+ "coverage>=7.5",
19
+ "hypothesis>=6.100",
20
+ "types-PyYAML",
21
+ ]
22
+
23
+ cli-pretty = ["rich>=13.0"]
24
+
25
+ [tool.mypy]
26
+ python_version = "3.10"
27
+ strict = true
28
+ ignore_missing_imports = true
29
+ pretty = true
30
+ # (or keep your current block if you prefer non-strict locally)
31
+
32
+ [tool.hatch.build.targets.wheel]
33
+ packages = ["statline"]
34
+ include = [
35
+ "statline/py.typed",
36
+ "statline/**/*.yaml",
37
+ "statline/**/*.yml",
38
+ "statline/**/*.json",
39
+ "statline/**/*.sql",
40
+ # keep any explicit includes you rely on:
41
+ "statline/data/**/*",
42
+ "statline/core/adapters/defs/*",
43
+ "statline/data/migrations/*.sql",
44
+ ]
45
+
46
+ [tool.hatch.build.targets.sdist]
47
+ include = ["statline", "tests", "README.md", "LICENSE", "pyproject.toml"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes