-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (41 loc) · 1.33 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
python = python3.11
MAXLINE = 120
SETUP_FILES = pyproject.toml
LOGO_FILE = logo.png
BUILD_DIR = dist
DOC_DIR = docs
PDOC_DIR = static
SRC_DIR = src
BUILD_VENV = benv
VENV = venv
get_url = from tomllib import loads; print(loads(open("pyproject.toml").read().strip())["project"]["urls"]["Homepage"])
.PHONY: package doc format lint type test clean
package: $(BUILD_DIR) $(BUILD_VENV)
$(BUILD_VENV)/bin/python -m build -o $(BUILD_DIR) .
doc: $(DOC_DIR)/$(LOGO_FILE) $(VENV)
VERSION="v$$($(VENV)/bin/python -m setuptools_scm)" \
$(VENV)/bin/pdoc -o $(DOC_DIR) -t $(PDOC_DIR) --logo "$(LOGO_FILE)" --logo-link "$$( \
$(VENV)/bin/python -c '$(get_url)' \
)" $(filter-out %.egg-info/,$(wildcard $(SRC_DIR)/*/))
format: $(VENV)
$(VENV)/bin/isort -l $(MAXLINE) --profile black --no-sections --combine-as --gitignore .
$(VENV)/bin/black --line-length=$(MAXLINE) .
lint: $(VENV)
$(VENV)/bin/flake8 --max-line-length=$(MAXLINE) .
type: $(VENV)
$(VENV)/bin/mypy .
test: $(VENV)
$(VENV)/bin/python -m unittest
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_VENV): $(SETUP_FILES)
$(python) -m venv $(BUILD_VENV)
$(BUILD_VENV)/bin/pip install -U pip build
touch $(BUILD_VENV)
$(VENV): $(SETUP_FILES)
$(python) -m venv $(VENV)
$(VENV)/bin/pip install -U pip
$(VENV)/bin/pip install -e .[dev,doc,quality,testing]
touch $(VENV)
clean:
git clean -dfx