File size: 1,447 Bytes
80cd1f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""Push the working tree to the Hugging Face Space as ONE normal commit (never squash).

Mirrors .gitignore: weights, caches, node_modules, dist, runtime cases, and local trace
exports stay out; the Docker build compiles llama.cpp and rebuilds the SPA bundle itself.
Remote-only files (e.g. partner-committed assets) are preserved - no delete patterns.

    python scripts/deploy_space.py "commit message"
"""

from __future__ import annotations

import sys

from huggingface_hub import HfApi

SPACE_ID = "build-small-hackathon/case0"

IGNORE = [
    ".git/**", ".venv/**", "**/__pycache__/**", "*.pyc", "*.egg-info/**",
    ".pytest_cache/**", ".mypy_cache/**", ".ruff_cache/**", ".coverage", "htmlcov/**",
    "models/**", "assets/voices/*.onnx", "assets/voices/*.onnx.json",
    "cases/runtime/**", ".cache/**", "*.log", ".DS_Store", "Thumbs.db",
    "assets/sprites/cache/**", ".playwright-mcp/**",
    "web/node_modules/**", "web/dist/**", "web/.vite/**",
    ".env", "traces/**", "web/gallery.html", "web/src/gallery-entry.ts", "*.png",
]


def main() -> int:
    message = sys.argv[1] if len(sys.argv) > 1 else "chore: update Space"
    api = HfApi()
    info = api.upload_folder(
        repo_id=SPACE_ID,
        repo_type="space",
        folder_path=".",
        ignore_patterns=IGNORE,
        commit_message=message,
    )
    print(f"pushed: {info.commit_url}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())