/
Makefile
88 lines (70 loc) · 1.86 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
81
82
83
84
85
86
87
88
.DEFAULT_GOAL := all
# Name of the project
NAME := posit-sdk
# Command aliases
PIP := pip3
PYTHON := python3
.PHONY:
build
clean
cov
default
deps
dev
fmt
fix
install
lint
test
uninstall
version
# Default target that runs the necessary steps to build the project
all: deps dev test lint build
# Target for building the project, which will generate the distribution files in the `dist` directory.
build:
$(PYTHON) -m build
# Target for cleaning up generated files and directories
clean:
rm -rf .coverage .mypy_cache .pytest_cache .ruff_cache *.egg-info build coverage.xml dist htmlcov coverage.xml
find . -name "*.egg-info" -exec rm -rf {} +
find . -name "*.pyc" -exec rm -f {} +
find . -name "__pycache__" -exec rm -rf {} +
find . -name "_version.py" -exec rm -rf {} +
find . -type d -empty -delete
# Target for generating coverage report
cov:
$(PYTHON) -m coverage report
# Target for generating HTML coverage report
cov-html:
$(PYTHON) -m coverage html
# Target for generating XML coverage report
cov-xml:
$(PYTHON) -m coverage xml
# Target for installing project dependencies
deps:
$(PIP) install -r requirements.txt -r requirements-dev.txt
# Target for installing the project in editable mode
dev:
$(PIP) install -e .
# Target for fixing linting issues.
fix:
$(PYTHON) -m ruff check --fix
# Target for formatting the code.
fmt:
$(PYTHON) -m ruff format .
# Target for installing the built distribution
install:
$(PIP) install dist/*.whl
# Target for running static type checking and linting
lint:
$(PYTHON) -m mypy --install-types --non-interactive .
$(PYTHON) -m ruff check
# Target for running tests with coverage
test:
$(PYTHON) -m coverage run --source=src --omit=_version.py -m pytest
# Target for uninstalling the project
uninstall:
$(PIP) uninstall -y $(NAME)
# Target for displaying the project version
version:
$(PYTHON) -m setuptools_scm