File size: 507 Bytes
d39e22c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import json
import shutil
from pathlib import Path
def write_text(text: str, path: Path):
with open(path, "w", encoding="utf-8") as f:
f.write(text)
def write_manifest(run_dir: Path, meta: dict):
with open(run_dir / "manifest.json", "w", encoding="utf-8") as f:
json.dump(meta, f, indent=2)
def make_zip(run_dir: Path) -> Path:
zip_path = run_dir.with_suffix("") # base name
shutil.make_archive(str(zip_path), "zip", str(run_dir))
return Path(str(zip_path) + ".zip")
|