"""Refresh the Space's vendored assets from the canonical project sources. A Hugging Face Space deploys only the contents of ``space/`` — it has no access to the project's ``src/`` package or ``eval/`` split. So the demo ships: * ``vendor/mundart/{__init__,eval,baseline}.py`` — verbatim copies of the tested, dependency-free LID modules (no re-implementation → no divergence risk; rerun this script after any change to the canonical modules); * ``data/{lid_train,probe_gsw_de}.jsonl`` — copies of the committed eval split the app trains the baseline on and uses for the gsw→de alignment lookup. Run from ``projects/03-mundart/``:: .venv/bin/python space/build_assets.py """ from __future__ import annotations import shutil from pathlib import Path _SPACE = Path(__file__).resolve().parent _PROJECT = _SPACE.parent #: Canonical pure modules → vendored package (copied verbatim). _MODULES = ("__init__.py", "eval.py", "baseline.py") #: Committed eval files the app needs at runtime. _DATA = ("lid_train.jsonl", "probe_gsw_de.jsonl") def main() -> int: src_pkg = _PROJECT / "src" / "mundart" dst_pkg = _SPACE / "vendor" / "mundart" dst_pkg.mkdir(parents=True, exist_ok=True) for name in _MODULES: shutil.copyfile(src_pkg / name, dst_pkg / name) print(f"vendored mundart/{name}") src_eval = _PROJECT / "eval" dst_data = _SPACE / "data" dst_data.mkdir(parents=True, exist_ok=True) for name in _DATA: shutil.copyfile(src_eval / name, dst_data / name) print(f"copied data/{name}") return 0 if __name__ == "__main__": raise SystemExit(main())