plane-mode-scholar / scripts /verify_org_space.py
PMS Sync
Deploy 000b308 (flattened for HF Spaces)
4577459
Raw
History Blame Contribute Delete
1.88 kB
#!/usr/bin/env python3
"""Verify build-small-hackathon/plane-mode-scholar README has submission metadata."""
from __future__ import annotations
import re
import sys
import urllib.request
ORG_README = (
"https://huggingface.co/spaces/build-small-hackathon/"
"plane-mode-scholar/raw/main/README.md"
)
SOCIAL_URL = "https://x.com/GuusBouwens/status/2066670913467400284"
REQUIRED_TAGS = (
"track:backyard",
"sponsor:nvidia",
"achievement:offgrid",
"achievement:welltuned",
"achievement:offbrand",
"achievement:llama",
"achievement:sharing",
"achievement:fieldnotes",
)
def fetch_readme() -> str:
req = urllib.request.Request(ORG_README, headers={"User-Agent": "plane-mode-scholar-verify"})
with urllib.request.urlopen(req, timeout=30) as resp:
return resp.read().decode("utf-8", errors="replace")
def main() -> int:
try:
text = fetch_readme()
except Exception as exc:
print(f"FAIL: could not fetch org Space README: {exc}")
return 1
ok = True
if SOCIAL_URL not in text:
print(f"FAIL: social post URL missing from org README")
print(f" expected: {SOCIAL_URL}")
ok = False
else:
print("OK: social post URL present")
if "[ADD YOUR X / LinkedIn POST URL HERE]" in text:
print("FAIL: org README still has social post placeholder")
ok = False
for tag in REQUIRED_TAGS:
if tag not in text:
print(f"FAIL: missing tag {tag!r}")
ok = False
if all(t in text for t in REQUIRED_TAGS):
print("OK: all hackathon achievement tags present")
sha_match = re.search(r"Deploy ([0-9a-f]+)", text)
if sha_match:
print(f"INFO: deploy marker {sha_match.group(1)}")
print(f"Check: {ORG_README}")
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())