Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions scripts/build_site_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
Stdlib only. Every fact names its source file so a reader can recompute.
"""
import json
import os
from pathlib import Path

ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
A = lambda p: os.path.join(ROOT, "assets", p)
ROOT = Path(__file__).resolve().parent.parent


def A(p):
return str(ROOT / "assets" / p)


def load(name):
Expand Down Expand Up @@ -53,8 +56,8 @@ def compute_facts():
"recall_at_10": meta["test_recall_at_10"],
"purity_at_20": round(meta["purity_at_20"], 4),
"archetype_top1": round(meta["archetype_top1_acc"], 4),
"onnx_bytes": os.path.getsize(A("mtnn.onnx")),
"embeddings_bytes": os.path.getsize(A("mtnn_embeddings.f32")),
"onnx_bytes": Path(A("mtnn.onnx")).stat().st_size,
"embeddings_bytes": Path(A("mtnn_embeddings.f32")).stat().st_size,
"eligibility": vectors["eligibility"]["method"],
"drift_pairs": len(drift["pairs"]),
"drift_biggest": {
Expand Down
8 changes: 4 additions & 4 deletions scripts/build_sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
were removed from the sitemap in the 2026-10-12 focus cuts.)
Run: python3 scripts/build_sitemap.py. Stdlib only."""
import json
import os
from datetime import date
from pathlib import Path

ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
ROOT = Path(__file__).resolve().parent.parent
BASE = "https://hoops.dumbmodel.com"
PAGES = ["/", "/play", "/live", "/players", "/insights", "/taxonomy",
"/methods", "/props-lab", "/playoff-runs"]


def main():
with open(os.path.join(ROOT, "assets", "insights.json"), encoding="utf-8") as f:
with open(ROOT / "assets" / "insights.json", encoding="utf-8") as f:
slugs = [c["slug"] for c in json.load(f)["insights"]]
# Insight stubs stay live for social unfurls but leave the sitemap
# (Wave 5): the hub page is the indexable surface.
Expand All @@ -24,7 +24,7 @@ def main():
for u in urls:
lines.append(f" <url><loc>{BASE}{u}</loc><lastmod>{today}</lastmod></url>")
lines.append("</urlset>")
with open(os.path.join(ROOT, "sitemap.xml"), "w", encoding="utf-8") as f:
with open(ROOT / "sitemap.xml", "w", encoding="utf-8") as f:
f.write("\n".join(lines) + "\n")
print(f"wrote sitemap.xml — {len(urls)} URLs ({len(PAGES)} pages)")

Expand Down
6 changes: 3 additions & 3 deletions scripts/check_site_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
data files. Fails (exit 1) when data moved and the sheet was not rebuilt —
the same contract as stamp_assets.py --check. Stdlib only."""
import json
import os
import sys
from pathlib import Path

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, str(Path(__file__).resolve().parent))
from build_site_facts import compute_facts, A


def main():
path = A("site_facts.json")
if not os.path.exists(path):
if not Path(path).exists():
print("FAIL assets/site_facts.json missing — run scripts/build_site_facts.py")
return 1
with open(path, encoding="utf-8") as f:
Expand Down
Loading