"""Write raw/hubstats.parquet (past downloads from cfahlgren1/hub-stats) by hand. python scripts/backfill_hubstats.py [--every 7] [--since 2025-01-01] [--push] The daily job does this by itself when the file is missing from the dataset (see hfeco/hubstats.py); this is for rebuilding it locally, e.g. with a different step. """ import argparse import sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT)) from hfeco import hubstats, org, store # noqa: E402 def main(): ap = argparse.ArgumentParser() ap.add_argument("--every", type=int, default=7) ap.add_argument("--since", default="2025-01-01") ap.add_argument("--push", action="store_true", help="upload raw/hubstats.parquet to the dataset") a = ap.parse_args() path = hubstats.backfill(org.history_ids(org.public_models()), a.every, a.since) if a.push: store.push([path], "hub-stats downloads history") print("pushed") if __name__ == "__main__": main()