from __future__ import annotations import getpass import os from pathlib import Path from huggingface_hub import HfApi PROJECT_DIR = Path(__file__).resolve().parents[1] def main() -> None: token = os.getenv("HF_TOKEN") or getpass.getpass("Hugging Face write token: ") if not token.startswith("hf_"): raise SystemExit("The token does not look like a Hugging Face token.") api = HfApi(token=token) namespace = api.whoami()["name"] repo_id = f"{namespace}/polymarket-lp-collector-source" api.create_repo(repo_id=repo_id, private=False, exist_ok=True) api.upload_folder( folder_path=PROJECT_DIR, repo_id=repo_id, ignore_patterns=[ ".git/**", ".venv/**", ".venv-hf/**", ".tools/**", "data/**", "upload/**", "**/__pycache__/**", "*.zip", ".env", ".koyeb.yaml", ], commit_message="Publish Render-ready Polymarket collector", ) print(f"Source: https://huggingface.co/{repo_id}") print(f"Git: https://huggingface.co/{repo_id}") print(f"Dataset: https://huggingface.co/datasets/{namespace}/polymarket-l2-history") if __name__ == "__main__": main()