-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
57 lines (44 loc) · 1.3 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
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
SYSPYTHON := python3
VENV := venv
BIN := $(VENV)/bin
pip-dependencies := requirements.txt requirements-dev.txt
pyproject-dependencies := $(patsubst %.txt,%-pep508.txt,$(pip-dependencies))
.PHONY: all
all: lint test build
$(VENV): pyproject.toml
$(SYSPYTHON) -m venv $(VENV)
$(BIN)/pip install --require-hashes -r requirements-dev.txt
$(BIN)/pip install --require-hashes -r requirements.txt
touch $(VENV)
.PHONY: lint
lint: $(VENV)
$(BIN)/ruff check .
$(BIN)/pyright --venvpath .
.PHONY: test
test: $(VENV)
$(BIN)/pytest
.PHONY: check
check: lint test
.PHONY: build
build: $(VENV) $(pyproject-dependencies)
rm -rf dist
$(BIN)/python -m build
.PHONY: clean
clean:
git clean -xdf
$(pip-dependencies): %.txt: %.in
$(BIN)/pip-compile --no-allow-unsafe --generate-hashes --output-file=requirements.txt requirements.in
$(BIN)/pip-compile --allow-unsafe --generate-hashes --output-file=requirements-dev.txt requirements-dev.in
.PHONY: regenerate-hashes
regenerate-hashes: delete-hashes $(pip-dependencies)
.PHONY: delete-hashes
delete-hashes:
rm -f $(pip-dependencies)
$(pyproject-dependencies): %-pep508.txt: %.txt
$(BIN)/pip-compile --allow-unsafe --output-file=$@ $<