ddebree's picture
Prepare Hugging Face Space deploy
3e67073
UV := $(shell if [ -x "$(HOME)/.local/bin/uv" ]; then printf "%s" "$(HOME)/.local/bin/uv"; else printf "uv"; fi)
DEMO_DIR ?= data/demo
DEMO_JSONL ?= $(DEMO_DIR)/demo.jsonl
ARTIFACTS ?= artifacts
INDEX ?= $(ARTIFACTS)/image-index.tsv
GALLERY ?= $(ARTIFACTS)/demo.html
.PHONY: sync sync-app sync-ijepa ready demo gallery app test type lint check clean clean-uv
sync:
$(UV) sync --dev
sync-app:
$(UV) sync --extra app --dev
sync-ijepa:
$(UV) cache clean mathvision-explorer
$(UV) sync --extra app --extra ijepa --dev
ready: sync-ijepa demo gallery check
demo:
$(UV) run --extra app python -c "from pathlib import Path; from mathvision_explorer.demo import create_demo_dataset; create_demo_dataset(Path('$(DEMO_DIR)'))"
gallery: demo
$(UV) run --extra app python -c "from pathlib import Path; from mathvision_explorer.dataset import load_jsonl_records; from mathvision_explorer.html import export_html; export_html(load_jsonl_records(Path('$(DEMO_JSONL)')), Path('$(GALLERY)'))"
app: demo
$(UV) run --extra app streamlit run app.py
test:
$(UV) run pytest
type:
$(UV) run mypy
lint:
$(UV) run ruff check .
check: test type lint
clean:
rm -rf $(ARTIFACTS) .pytest_cache .mypy_cache .ruff_cache
find src tests -type d -name __pycache__ -prune -exec rm -rf {} +
clean-uv:
$(UV) cache clean
rm -rf .venv