pyrox-client 0.0.1__py3-none-any.whl

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.
pyrox/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "0.0.1"
pyrox/client.py ADDED
@@ -0,0 +1,49 @@
1
+ import pandas as pd
2
+ import io, json, requests
3
+ from dataclasses import dataclass
4
+
5
+ CDN_BASE = "https://<your-cloudfront-domain>/<prefix>"
6
+
7
+
8
+ @dataclass(frozen=True)
9
+ class EventRef:
10
+ season: int
11
+ event_id: str
12
+ race: str
13
+ key: str # "season=7/Cardiff_2025__LR3MS4JIB56.parquet"
14
+
15
+
16
+ def _manifest():
17
+ url = f"{CDN_BASE}/catalog/manifest-v1.json"
18
+ r = requests.get(url, timeout=20)
19
+ r.raise_for_status()
20
+ return r.json()
21
+
22
+
23
+ def list_seasons() -> list[int]:
24
+ return _manifest()["seasons"]
25
+
26
+
27
+ def list_events(season: int | None = None) -> list[EventRef]:
28
+ m = _manifest()["events"]
29
+ if season is not None:
30
+ m = [e for e in m if e["season"] == season]
31
+ return [EventRef(**{k: e[k] for k in ("season", "event_id", "race", "key")}) for e in m]
32
+
33
+
34
+ def get_race(*, season: int | None = None, location: str | None = None, event_id: str | None = None) -> pd.DataFrame:
35
+ events = list_events(season)
36
+ if event_id:
37
+ ev = next(e for e in events if e.event_id == event_id)
38
+ elif location:
39
+ # naive match; you can add fuzzy/normalized matching later
40
+ cand = [e for e in events if location.lower() in e.race.lower()]
41
+ if not cand:
42
+ raise ValueError(f"No event matching {location!r}")
43
+ ev = cand[0]
44
+ else:
45
+ raise ValueError("Provide event_id or location (optionally season).")
46
+ url = f"{CDN_BASE}/{ev.key}"
47
+ resp = requests.get(url, timeout=60)
48
+ resp.raise_for_status()
49
+ return pd.read_parquet(io.BytesIO(resp.content))
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyrox-client
3
+ Version: 0.0.1
4
+ Summary: HYROX race data client - retrieve full race results via Python
5
+ Project-URL: homepage, https://github.com/<you>/pyrox
6
+ Author: Vlad Matei
7
+ License: MIT
8
+ Requires-Python: >=3.9
9
+ Requires-Dist: fastparquet>=15
10
+ Requires-Dist: pandas>=2.0
11
+ Requires-Dist: requests>=2.31
12
+ Provides-Extra: duckdb
13
+ Requires-Dist: duckdb>=1.0.0; extra == 'duckdb'
14
+ Description-Content-Type: text/markdown
15
+
16
+ Package to retrieve Hyrox race data programatically.
17
+
@@ -0,0 +1,5 @@
1
+ pyrox/__init__.py,sha256=sXLh7g3KC4QCFxcZGBTpG2scR7hmmBsMjq6LqRptkRg,22
2
+ pyrox/client.py,sha256=SknlWuPYm-uDkfZ1sYQhAU3zrdG2dVkGrVpHUkM1Q0U,1514
3
+ pyrox_client-0.0.1.dist-info/METADATA,sha256=JF8gP7qqc0c24IJgwyGJbCu76RMMSdbylUk86KJjCtU,491
4
+ pyrox_client-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
+ pyrox_client-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any