Index of theproofnetwork/open-problems@860a535/scripts/fetch_erdos_metadata.py
qedmarket’s copy of theproofnetwork/open-problems@860a535, 3 Dec 2026original source ↗
#!/usr/bin/env python3"""Fetch erdosproblems.com's metadata (tags, prize, status) for the index. python3 -I scripts/fetch_erdos_metadata.py [<commit of teorth/erdosproblems>] Reads `data/problems.yaml` of https://github.com/teorth/erdosproblems (Apache-2.0) at a pinned commit (theargument, else the one below) and writes metadata/erdos.json: per problem number its tags, itsprize ("$500", or none) and its status ("open", "proved (Lean)", …). scripts/build_index.py reads that file."""import jsonimport sysimport urllib.requestfrom pathlib import Path import yaml ROOT = Path(__file__).resolve().parent.parentREPO = "https://github.com/teorth/erdosproblems"COMMIT = "9ccd48d72179f5645d494ea1e4fea89ee6216fe2" # 2026-11-30 def main(argv): commit = argv[0] if argv else COMMIT url = f"https://raw.githubusercontent.com/teorth/erdosproblems/{commit}/data/problems.yaml" with urllib.request.urlopen(urllib.request.Request(url, headers={"User-Agent": "open-problems"}), timeout=60) as r: data = yaml.safe_load(r.read()) problems = {} for p in data: prize = p.get("prize") problems[str(p["number"])] = { "tags": p.get("tags") or [], "prize": prize if prize and prize != "no" else None, "status": (p.get("status") or {}).get("state"), } out = ROOT / "metadata/erdos.json" out.parent.mkdir(exist_ok=True) out.write_text(json.dumps({ "source": f"{REPO}/blob/{commit}/data/problems.yaml", "commit": commit, "license": "Apache-2.0", "problems": dict(sorted(problems.items(), key=lambda kv: int(kv[0]) if kv[0].isdigit() else 10**9)), }, indent=1, ensure_ascii=False) + "\n") print(f"{len(problems)} problems, {sum(1 for p in problems.values() if p['prize'])} with a prize") if __name__ == "__main__": main(sys.argv[1:])