#!/usr/bin/env python3 """Fetch one draft year from Basketball-Reference and rebuild the panel. Usage: python extend_year.py --year 2021 python extend_year.py --year 2027 --force """ from __future__ import annotations import argparse import subprocess import sys from pathlib import Path SCRIPTS = Path(__file__).resolve().parent def main() -> None: ap = argparse.ArgumentParser(description=__doc__) ap.add_argument("--year", type=int, required=True) ap.add_argument("--force", action="store_true", help="refetch player pages") args = ap.parse_args() fetch = [ sys.executable, str(SCRIPTS / "fetch_bbref_draft_hs.py"), "--years", str(args.year), ] if args.force: fetch.append("--force") subprocess.check_call(fetch) subprocess.check_call([sys.executable, str(SCRIPTS / "build_panel.py")]) print(f"Extended panel with draft year {args.year}") if __name__ == "__main__": main()