-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (54 loc) · 1.84 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
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
# .DELETE_ON_ERROR:
MAKEFLAGS = --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
# Override PWD so that it's always based on the location of the file and **NOT**
# based on where the shell is when calling `make`. This is useful if `make`
# is called like `make -C <some path>`
PWD := $(realpath $(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
WORKTREE_ROOT := $(shell git rev-parse --show-toplevel 2> /dev/null)
# Using $$() instead of $(shell) to run evaluation only when it's accessed
# https://unix.stackexchange.com/a/687206
py = $$(if [ -d $(PWD)/'.venv' ]; then echo $(PWD)/".venv/bin/python3"; else echo "python3"; fi)
pip = $(py) -m pip
.DEFAULT_GOAL := help
.PHONY: help check check-fix dev
help: ## Display this help section
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z\$$/]+.*:.*?##\s/ {printf "\033[36m%-38s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.venv: # requirements.txt ## Build the virtual environment
$(py) -m venv .venv
$(pip) install -U pip setuptools wheel build
$(pip) install -U -r requirements.txt
touch .venv
check:
ruff check .
fmt:
ruff check . --fix
dev:
flask --app web run
# Misc
.PHONY: clean ## misc - Clear local caches and build artifacts
clean:
@echo "\033[1mCleaning up:\033[0m\n\033[35m This will remove all local caches and build artifacts\033[0m"
@rm -rf `find . -name __pycache__`
@rm -f `find . -type f -name '*.py[co]'`
@rm -f `find . -type f -name '*~'`
@rm -f `find . -type f -name '.*~'`
@rm -rf .run
@rm -rf .venv
@rm -rf .venvs
@rm -rf .cache
@rm -rf .pytest_cache
@rm -rf .ruff_cache
@rm -rf htmlcov
@rm -rf *.egg-info
@rm -f .coverage
@rm -f .coverage.*
@rm -rf build
@rm -rf dist
@rm -rf site
@rm -rf docs/_build
@rm -rf docs/.changelog.md docs/.version.md docs/.tmp_schema_mappings.html
@rm -rf fastapi/test.db
@rm -rf coverage.xml