This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
80 lines (62 loc) · 2.06 KB
/
Makefile
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#
# Makefile
#
.PHONY: etl
include default.mk
SRC = app crawler tests
help:
@echo 'Available commands:'
@echo
@echo ' make crawl Crawl ETL catalog'
@echo ' make api Run API server'
@echo ' make test Run all linting and unit tests'
@echo ' make testdb Rebuild test DB'
@echo ' make watch Run all tests, watching for changes'
@echo ' make clobber Delete non-reference data and .venv'
@echo ' make run Run API and Catalog in the background'
@echo
watch-all:
.venv/bin/watchmedo shell-command -c 'clear; make unittest; (cd vendor/owid-catalog-py && make unittest)' --recursive --drop .
test-all: test
cd vendor/owid-catalog-py && make test
watch: .venv
.venv/bin/watchmedo shell-command -c 'clear; make check-formatting lint check-typing coverage' --recursive --drop .
.submodule-init:
@echo '==> Initialising submodules'
git submodule update --init
touch $@
.venv: pyproject.toml poetry.toml poetry.lock .submodule-init
@echo '==> Copy .env.example to .env if missing'
cp -n .env.example .env || true
@echo '==> Installing packages'
poetry install
touch $@
check-typing: .venv
# @echo '==> Checking types'
# .venv/bin/mypy $(SRC)
@echo '==> WARNING: Checking types is disabled!'
coverage: .venv
@echo '==> Unit testing with coverage'
.venv/bin/pytest --cov=app --cov-report=term-missing tests
crawl: .venv
@echo '==> Crawl ETL catalog'
poetry run crawl
crawl-backported: .venv
@echo '==> Crawl backported ETL catalog'
poetry run crawl --include dataset_
api: .venv
@echo '==> Running API'
.venv/bin/hypercorn app.main:app --reload
testdb: .venv
@echo '==> Rebuild test DB'
rm -f tests/sample_duck.db
poetry run crawl --include 'dataset_941|ggdc_maddison' --duckdb-path tests/sample_duck.db
clobber: clean
find . -name .venv | xargs rm -rf
find . -name .mypy_cache | xargs rm -rf
run: .venv
@echo 'Running API and Catalog in the background:'
-kill $(lsof -t -i:8000)
-kill $(lsof -t -i:8001)
nohup make api > api.log 2> api.err < /dev/null &
nohup .venv/bin/python -m demo.demo > demo.log 2> demo.err < /dev/null &