statline 2.0.0__tar.gz → 2.0.2__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 (50) hide show
  1. statline-2.0.2/.gitignore +89 -0
  2. {statline-2.0.0 → statline-2.0.2}/PKG-INFO +5 -1
  3. {statline-2.0.0 → statline-2.0.2}/pyproject.toml +6 -1
  4. {statline-2.0.0 → statline-2.0.2}/statline/cli.py +23 -30
  5. statline-2.0.0/.gitignore +0 -61
  6. statline-2.0.0/statline/.keys.json +0 -20
  7. statline-2.0.0/statline/secrets/DEVKEY +0 -1
  8. statline-2.0.0/statline/secrets/REGKEY +0 -1
  9. statline-2.0.0/statline/secrets/keys/XhRQhRj7.reg +0 -1
  10. {statline-2.0.0 → statline-2.0.2}/LICENSE +0 -0
  11. {statline-2.0.0 → statline-2.0.2}/README.md +0 -0
  12. {statline-2.0.0 → statline-2.0.2}/statline/__init__.py +0 -0
  13. {statline-2.0.0 → statline-2.0.2}/statline/core/__init__.py +0 -0
  14. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/__init__.py +0 -0
  15. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/compile.py +0 -0
  16. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/defs/demo.yaml +0 -0
  17. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/example.yaml +0 -0
  18. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/hooks.py +0 -0
  19. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/loader.py +0 -0
  20. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/registry.py +0 -0
  21. {statline-2.0.0 → statline-2.0.2}/statline/core/adapters/types.py +0 -0
  22. {statline-2.0.0 → statline-2.0.2}/statline/core/calculator.py +0 -0
  23. {statline-2.0.0 → statline-2.0.2}/statline/core/normalization.py +0 -0
  24. {statline-2.0.0 → statline-2.0.2}/statline/core/scoring.py +0 -0
  25. {statline-2.0.0 → statline-2.0.2}/statline/core/weights.py +0 -0
  26. {statline-2.0.0 → statline-2.0.2}/statline/data/stats/dba_s0.csv +0 -0
  27. {statline-2.0.0 → statline-2.0.2}/statline/data/stats/demo.csv +0 -0
  28. {statline-2.0.0 → statline-2.0.2}/statline/py.typed +0 -0
  29. {statline-2.0.0 → statline-2.0.2}/statline/slapi/__init__.py +0 -0
  30. {statline-2.0.0 → statline-2.0.2}/statline/slapi/adapters.py +0 -0
  31. {statline-2.0.0 → statline-2.0.2}/statline/slapi/app.py +0 -0
  32. {statline-2.0.0 → statline-2.0.2}/statline/slapi/auth.py +0 -0
  33. {statline-2.0.0 → statline-2.0.2}/statline/slapi/auth_local.py +0 -0
  34. {statline-2.0.0 → statline-2.0.2}/statline/slapi/cache.py +0 -0
  35. {statline-2.0.0 → statline-2.0.2}/statline/slapi/config.py +0 -0
  36. {statline-2.0.0 → statline-2.0.2}/statline/slapi/errors.py +0 -0
  37. {statline-2.0.0 → statline-2.0.2}/statline/slapi/public.py +0 -0
  38. {statline-2.0.0 → statline-2.0.2}/statline/slapi/pydantic.pyi +0 -0
  39. {statline-2.0.0 → statline-2.0.2}/statline/slapi/schemas.py +0 -0
  40. {statline-2.0.0 → statline-2.0.2}/statline/slapi/scoring.py +0 -0
  41. {statline-2.0.0 → statline-2.0.2}/statline/slapi/storage/__init__.py +0 -0
  42. {statline-2.0.0 → statline-2.0.2}/statline/slapi/storage/csv.py +0 -0
  43. {statline-2.0.0 → statline-2.0.2}/statline/slapi/storage/migrations/001_init.sql +0 -0
  44. {statline-2.0.0 → statline-2.0.2}/statline/slapi/storage/migrations/002_add_indexes.sql +0 -0
  45. {statline-2.0.0 → statline-2.0.2}/statline/slapi/storage/migrations/003_triggers.sql +0 -0
  46. {statline-2.0.0 → statline-2.0.2}/statline/slapi/storage/sqlite.py +0 -0
  47. {statline-2.0.0 → statline-2.0.2}/statline/utils/logging.py +0 -0
  48. {statline-2.0.0 → statline-2.0.2}/statline/utils/paths.py +0 -0
  49. {statline-2.0.0 → statline-2.0.2}/statline/utils/timing.py +0 -0
  50. {statline-2.0.0 → statline-2.0.2}/tests/__init__.py +0 -0
@@ -0,0 +1,89 @@
1
+ # -------------------------
2
+ # Python
3
+ __pycache__/
4
+ *.py[cod]
5
+ *.pyo
6
+ *.pyd
7
+ *.so
8
+ *.dylib
9
+ .build/
10
+ build/
11
+ dist/
12
+ .eggs/
13
+ *.egg-info/
14
+ pip-wheel-metadata/
15
+
16
+ # Virtual envs
17
+ .venv/
18
+ venv/
19
+ env/
20
+ .conda/
21
+ .pyenv/
22
+ .python-version
23
+
24
+ # Tool caches
25
+ .mypy_cache/
26
+ .ruff_cache/
27
+ .pytest_cache/
28
+ .cache/
29
+ .nox/
30
+ .tox/
31
+
32
+ # Coverage
33
+ .coverage
34
+ .coverage.*
35
+ coverage.xml
36
+ htmlcov/
37
+ coverage/
38
+
39
+ # Editors / OS
40
+ .idea/
41
+ .vscode/
42
+ *.code-workspace
43
+ .DS_Store
44
+ Thumbs.db
45
+ .ipynb_checkpoints/
46
+
47
+ # Env / secrets
48
+ statline/.keys.json
49
+ .env
50
+ .env.*
51
+ .envrc
52
+ .direnv/
53
+ # Repo-level secrets (tracked dir, ignore contents)
54
+ secrets/**
55
+ !secrets/.gitkeep
56
+ # Package-level secrets (tracked dir, ignore contents)
57
+ statline/secrets/**
58
+ !statline/secrets/.gitkeep
59
+ # Gifted/issued keys & local activation file
60
+ **/secrets/REGKEY
61
+ **/secrets/DEVKEY
62
+ **/secrets/keys/
63
+ *.reg
64
+
65
+ # Local data/state
66
+ max_stats.json
67
+ max_stats.local.json
68
+ data/*.sqlite
69
+ data/*.sqlite*
70
+ data/*.db
71
+ data/*.db*
72
+ *.log
73
+
74
+ # SLAPI storage (local sqlite files)
75
+ statline/slapi/storage/*.sqlite
76
+ statline/slapi/storage/*.sqlite*
77
+ statline/slapi/storage/*.db
78
+ statline/slapi/storage/*.db*
79
+
80
+ # Certificates / private keys (just in case)
81
+ *.pem
82
+ *.crt
83
+ *.key
84
+ *.p12
85
+
86
+ # Hatch / packaging
87
+ *.egg
88
+ MANIFEST
89
+ uv.lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statline
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: StatLine — weighted player scoring, efficiency modeling, and CLI tooling
5
5
  Project-URL: Homepage, https://github.com/amillolive/StatLine
6
6
  Project-URL: Repository, https://github.com/amillolive/StatLine
@@ -49,10 +49,14 @@ Classifier: Programming Language :: Python :: 3.13
49
49
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
50
50
  Requires-Python: <3.14,>=3.10
51
51
  Requires-Dist: fastapi<1.0,>=0.110
52
+ Requires-Dist: httpx>=0.27
52
53
  Requires-Dist: pydantic<3.0,>=2.0
53
54
  Requires-Dist: pyyaml>=6
54
55
  Requires-Dist: typer>=0.12
55
56
  Requires-Dist: typing-extensions>=4.7; python_version < '3.11'
57
+ Provides-Extra: cli
58
+ Requires-Dist: httpx>=0.27; extra == 'cli'
59
+ Requires-Dist: types-requests; (python_version < '3.14') and extra == 'cli'
56
60
  Provides-Extra: cli-pretty
57
61
  Requires-Dist: rich>=13.0; extra == 'cli-pretty'
58
62
  Provides-Extra: dev
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "statline"
7
- version = "2.0.0"
7
+ version = "2.0.2"
8
8
  description = "StatLine — weighted player scoring, efficiency modeling, and CLI tooling"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10,<3.14"
@@ -31,11 +31,16 @@ dependencies = [
31
31
  'typing-extensions>=4.7; python_version < "3.11"',
32
32
  "pydantic>=2.0,<3.0",
33
33
  "fastapi>=0.110,<1.0",
34
+ "httpx>=0.27",
34
35
  ]
35
36
 
36
37
  [project.optional-dependencies]
37
38
  sheets = ["gspread>=6.0.0", "google-auth>=2.0.0"]
38
39
  cli-pretty = ["rich>=13.0"]
40
+ cli = [
41
+ "httpx>=0.27",
42
+ "types-requests; python_version<'3.14'"
43
+ ]
39
44
  dev = [
40
45
  "pytest>=8.1",
41
46
  "pytest-cov>=4.1",
@@ -27,15 +27,23 @@ from typing import (
27
27
 
28
28
  # ── third-party ───────────────────────────────────────────────────────────────
29
29
  import click # Typer is built on Click
30
+ import httpx
30
31
  import typer
31
32
 
32
33
  # ── HTTP backend (quiet for type checkers) ────────────────────────────────────
33
- _http: Any # single alias we treat as Any to avoid Pylance noise
34
+
35
+ # Avoid mypy "no-redef": import into distinct names, then pick one alias.
36
+ _http: Any # single module-like alias we treat as Any to keep linters quiet
34
37
  try:
35
- import httpx as _http
38
+ import httpx as _httpx
39
+ _http = _httpx
36
40
  _http_lib = "httpx"
37
41
  except Exception: # pragma: no cover
38
- import requests as _http
42
+ try:
43
+ import requests as _requests
44
+ except Exception as _e: # extremely defensive; shouldn't happen in prod
45
+ raise RuntimeError("Neither httpx nor requests is available") from _e
46
+ _http = _requests
39
47
  _http_lib = "requests"
40
48
 
41
49
  # ── banner & timing defaults ──────────────────────────────────────────────────
@@ -308,17 +316,17 @@ def _headers(*, extra: Optional[Dict[str, str]] = None, use_regkey: bool = True)
308
316
 
309
317
  # ── HTTP client helpers ───────────────────────────────────────────────────────
310
318
 
311
- def _http_get(path: str, params: Optional[Dict[str, Any]] = None, *,
312
- extra_headers: Optional[Dict[str, str]] = None) -> Any:
319
+ def _http_get(
320
+ path: str,
321
+ params: Optional[Dict[str, Any]] = None,
322
+ *,
323
+ extra_headers: Optional[Dict[str, str]] = None,
324
+ ) -> Any:
313
325
  url = f"{_slapi_url}{path}"
314
326
  use_reg = not path.startswith("/v2/admin")
315
- if _http_lib == "httpx" and hasattr(_http, "Client"):
316
- with _http.Client(timeout=60.0) as c:
317
- r = c.get(url, headers=_headers(extra=extra_headers, use_regkey=use_reg), params=params)
318
- _raise_for_status(r)
319
- return r.json()
320
- else:
321
- r = _http.get(url, headers=_headers(extra=extra_headers, use_regkey=use_reg), params=params, timeout=60.0)
327
+ headers = _headers(extra=extra_headers, use_regkey=use_reg)
328
+ with httpx.Client(timeout=60.0) as c:
329
+ r = c.get(url, headers=headers, params=params)
322
330
  _raise_for_status(r)
323
331
  return r.json()
324
332
 
@@ -331,24 +339,9 @@ def _http_post(
331
339
  ) -> Any:
332
340
  url = f"{_slapi_url}{path}"
333
341
  use_reg = not path.startswith("/v2/admin")
334
- if _http_lib == "httpx" and hasattr(_http, "Client"):
335
- with _http.Client(timeout=300.0) as c:
336
- r = c.post(
337
- url,
338
- headers=_headers(extra=extra_headers, use_regkey=use_reg),
339
- params=params,
340
- json=payload, # send proper JSON
341
- )
342
- _raise_for_status(r)
343
- return r.json()
344
- else:
345
- r = _http.post(
346
- url,
347
- headers=_headers(extra=extra_headers, use_regkey=use_reg),
348
- params=params,
349
- json=payload,
350
- timeout=300.0,
351
- )
342
+ headers = _headers(extra=extra_headers, use_regkey=use_reg)
343
+ with httpx.Client(timeout=300.0) as c:
344
+ r = c.post(url, headers=headers, params=params, json=payload)
352
345
  _raise_for_status(r)
353
346
  return r.json()
354
347
 
statline-2.0.0/.gitignore DELETED
@@ -1,61 +0,0 @@
1
-
2
- # .gitignore
3
- ```gitignore
4
- # Python
5
- __pycache__/
6
- *.py[cod]
7
- *.pyo
8
- *.pyd
9
- *.so
10
- *.dylib
11
- .build/
12
- build/
13
- dist/
14
- .eggs/
15
- *.egg-info/
16
- pip-wheel-metadata/
17
-
18
- # Virtual envs
19
- .venv/
20
- venv/
21
- env/
22
- .conda/
23
- .pyenv/
24
- .python-version
25
-
26
- # Tool caches
27
- .mypy_cache/
28
- .ruff_cache/
29
- .pytest_cache/
30
- .cache/
31
- .nox/
32
- .tox/
33
-
34
- # Coverage
35
- .coverage
36
- coverage.xml
37
- htmlcov/
38
-
39
- # Editors / OS
40
- .idea/
41
- .vscode/
42
- *.code-workspace
43
- .DS_Store
44
- Thumbs.db
45
-
46
- # Env / secrets
47
- .env
48
- .env.*
49
- !secrets/.gitkeep
50
-
51
- # Local data/state
52
- max_stats.json
53
- max_stats.local.json
54
- data/*.sqlite
55
- data/*.db
56
- *.log
57
-
58
- # Hatch / packaging
59
- *.egg
60
- MANIFEST
61
- uv.lock
@@ -1,20 +0,0 @@
1
- {
2
- "version": 1,
3
- "keys": [
4
- {
5
- "prefix": "XhRQhRj7",
6
- "reg_hash": "1e36baa1d4aff7f69f4c546fbda97f7a751dbeeb23625142e18bf82f23270cbe",
7
- "owner": "G16-NOBARA",
8
- "scopes": [
9
- "score",
10
- "map",
11
- "calc"
12
- ],
13
- "access": true,
14
- "host_fp": "67b52803961912de",
15
- "created_at": 1758256553.0171804,
16
- "last_used_at": 1758256632.7338417,
17
- "expires_at": null
18
- }
19
- ]
20
- }
@@ -1 +0,0 @@
1
- �ɹ�,�~R�5���ޫ�E,jt�63���Ⱟ
@@ -1 +0,0 @@
1
- reg_XhRQhRj7ZeJ_5NnY0-yqFh0GzNTMwnqs3u9jxSkt3Fs
@@ -1 +0,0 @@
1
- reg_XhRQhRj7ZeJ_5NnY0-yqFh0GzNTMwnqs3u9jxSkt3Fs
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes