File size: 1,323 Bytes
3e67073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
46
47
48
49
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