-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (38 loc) · 1.64 KB
/
Makefile
File metadata and controls
50 lines (38 loc) · 1.64 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
# Delete target on error.
# https://www.gnu.org/software/make/manual/html_node/Errors.html#Errors
# > This is almost always what you want make to do, but it is not historical
# > practice; so for compatibility, you must explicitly request it
.DELETE_ON_ERROR:
REQUIREMENTS_PATH ?= requirements/dev.txt
VIRTUAL_ENV ?= .venv
export PATH := $(VIRTUAL_ENV)/bin:$(PATH)
# Python
# =============================================================================
.PHONY: venv compile-deps
PYTHON ?= python3.12
$(VIRTUAL_ENV): $(REQUIREMENTS_PATH)
uv venv --python $(PYTHON)
uv pip sync --require-hashes $^
touch $@
venv: $(VIRTUAL_ENV)
PIP_COMPILE_FLAGS := --generate-hashes $(PIP_COMPILE_OPTIONS)
compile-deps: $(VIRTUAL_ENV)
uv pip compile $(PIP_COMPILE_FLAGS) -o requirements/base.txt requirements/base.in
uv pip compile $(PIP_COMPILE_FLAGS) -o requirements/dev.txt requirements/dev.in
# Quality
# =============================================================================
.PHONY: fast_fix fix quality test test-streamlit clean
MONITORED_DIRS := dags dbt
SQLFLUFF_OPTIONS := --disable-progress-bar --nocolor
fast_fix: $(VIRTUAL_ENV)
ruff format $(MONITORED_DIRS)
ruff check --fix $(MONITORED_DIRS)
find * -type f -name '*.sh' -exec shellcheck --external-sources --format=diff {} + | git apply --allow-empty
# if `sqlfluff fix` does not work, use `sqlfluff parse` to investigate.
fix: fast_fix
sqlfluff fix $(SQLFLUFF_OPTIONS) $(MONITORED_DIRS)
quality: $(VIRTUAL_ENV)
ruff format --check $(MONITORED_DIRS)
ruff check $(MONITORED_DIRS)
find * -type f -name '*.sh' -exec shellcheck --external-sources {} +
sqlfluff lint $(SQLFLUFF_OPTIONS) $(MONITORED_DIRS)