#!/usr/bin/env python3 """Simple asset checker for CI: ensures benchmark.md and image assets exist. Exits with non-zero if checks fail. """ from pathlib import Path import sys errors = [] benchmark = Path("src/benchmark.md") if not benchmark.exists(): errors.append("Missing src/benchmark.md") images_dir = Path("src/Images") if not images_dir.exists() or not any(images_dir.iterdir()): errors.append("Missing or empty src/Images directory") else: # Optional: check that images referenced in streamlit_app.py exist # We'll parse simple occurs of src/Images/ in the file app_file = Path("src/streamlit_app.py") try: text = app_file.read_text() referenced = set() for part in text.split(): if "src/Images/" in part: # strip punctuation candidate = part.strip("\"'(),") if candidate.startswith("src/Images/"): referenced.add(candidate) for ref in referenced: p = Path(ref) if not p.exists(): errors.append(f"Referenced image missing: {ref}") except Exception as e: errors.append(f"Could not read src/streamlit_app.py: {e}") if errors: print("ASSET CHECK FAILED:\n" + "\n".join(errors)) sys.exit(2) print("Asset check passed") sys.exit(0)