PY := python3 VENV := venv PIP := $(VENV)/bin/pip PYTHON := $(VENV)/bin/python # CPU Torch pin (works on macOS Intel + Apple Silicon; change if you want Metal) TORCH_SPEC := torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu .PHONY: setup install ingest ui check freeze clean nuke setup: ## Create venv and install everything (one-time or rebuild) @test -d $(VENV) || $(PY) -m venv $(VENV) $(PIP) install --upgrade pip wheel setuptools $(PIP) install $(TORCH_SPEC) $(PIP) install -r requirements.txt install: ## Install/refresh deps from requirements.txt (venv must exist) $(PIP) install -r requirements.txt ingest: ## Run your ingest as a module so 'app' is a package $(PYTHON) -m app.ingest ui: ## Launch Streamlit UI $(VENV)/bin/streamlit run app/ui_streamlit.py check: ## Validate YAML config $(PYTHON) -c "import yaml; yaml.safe_load(open('config/sources.yaml')); print('✅ YAML OK')" freeze: ## Snapshot exact versions for reproducibility $(PIP) freeze > requirements.lock.txt @echo "Wrote requirements.lock.txt" clean: ## Remove build caches (keep venv) rm -rf __pycache__ .pytest_cache .streamlit/cache .mypy_cache nuke: ## Remove EVERYTHING (including venv) - be careful rm -rf $(VENV) __pycache__ .pytest_cache .streamlit/cache .mypy_cache