Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (47 loc) · 1.87 KB
/
Copy pathMakefile
File metadata and controls
65 lines (47 loc) · 1.87 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
PY := .venv/bin/python
PIP := .venv/bin/pip
# Where host runs keep SQLite. The app's own default is the container
# volume, /data, which does not exist on a host; make targets that touch
# the database (resync, seed, run) use ./data instead, git-ignored. An
# exported DATA_PATH in your shell still wins.
DATA_PATH ?= ./data
export DATA_PATH
.PHONY: help setup venv ingest pull resync seed run test lint fmt audit up down logs rebuild
help:
@grep -E '^[a-z-]+:.*?## ' $(MAKEFILE_LIST) | \
awk 'BEGIN{FS=":.*?## "}{printf " %-10s %s\n", $$1, $$2}'
setup: ## One-shot: clone sources, build content, start the app
./scripts/setup.sh
venv: ## Create .venv and install dev dependencies
python3 -m venv .venv
$(PIP) install --upgrade pip
$(PIP) install -r requirements-dev.txt
ingest: ## Build content/ from the source repositories
$(PY) ingest.py
pull: ## Fast-forward the source clones from their remotes (no ingest)
$(PY) -m ingestion.upstream
resync: ## Pull the source clones, re-sync content/, then reseed SQLite
$(PY) resync.py
seed: ## Upsert content/ into SQLite
$(PY) -m app.seed
run: ## Serve locally on $$PORT (default 8775)
$(PY) -m app
test: ## Run the test suite
.venv/bin/pytest -q
lint: ## flake8 + mypy + bandit
.venv/bin/flake8 app ingestion tests ingest.py resync.py
.venv/bin/mypy app ingestion
.venv/bin/bandit -q -r app ingestion -c pyproject.toml
fmt: ## Format with black + isort
.venv/bin/isort app ingestion tests ingest.py resync.py
.venv/bin/black app ingestion tests ingest.py resync.py
audit: ## Audit pinned runtime dependencies
.venv/bin/pip-audit -r requirements.txt
up: ## Build and start the container
docker compose up --build -d
down: ## Stop the container (keeps the app-data volume)
docker compose down
logs: ## Follow container logs
docker compose logs -f
rebuild: ## Rebuild after a content/ change and restart
docker compose up --build -d