-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMakefile
68 lines (50 loc) · 1.78 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
PYTHON=python3
PYTHON_ENV_ROOT=envs
PYTHON_PACKAGING_VENV=$(PYTHON_ENV_ROOT)/$(PYTHON)-packaging-env
PYTHON_QA_ENV=$(PYTHON_ENV_ROOT)/$(PYTHON)-qa-env
# packaging environment #######################################################
.PHONY: packaging-env build _release
$(PYTHON_PACKAGING_VENV)/.created:
rm -rf $(PYTHON_PACKAGING_VENV) && \
$(PYTHON) -m venv $(PYTHON_PACKAGING_VENV) && \
. $(PYTHON_PACKAGING_VENV)/bin/activate && \
$(PYTHON) -m pip install --upgrade pip && \
$(PYTHON) -m pip install build
date > $(PYTHON_PACKAGING_VENV)/.created
.PHONY: packaging-env build
packaging-env: $(PYTHON_PACKAGING_VENV)/.created
build: packaging-env
. $(PYTHON_PACKAGING_VENV)/bin/activate && \
rm -rf dist *.egg-info && \
$(PYTHON) -m build
# helper ######################################################################
.PHONY: clean envs
clean:
rm -rf $(PYTHON_ENV_ROOT)
envs: packaging-env qa-env
# testing #####################################################################
.PHONY: qa qa-env qa-codespell qa-pytest qa-ruff
$(PYTHON_QA_ENV)/.created:
rm -rf $(PYTHON_QA_ENV) && \
$(PYTHON) -m venv $(PYTHON_QA_ENV) && \
. $(PYTHON_QA_ENV)/bin/activate && \
$(PYTHON) -m pip install pip --upgrade && \
$(PYTHON) -m pip install codespell ruff pytest pytest-mock && \
date > $(PYTHON_QA_ENV)/.created
qa-env: $(PYTHON_QA_ENV)/.created
qa: qa-codespell qa-pytest qa-ruff
qa-codespell: qa-env
. $(PYTHON_QA_ENV)/bin/activate && \
codespell
qa-codespell-fix: qa-env
. $(PYTHON_QA_ENV)/bin/activate && \
codespell -w
qa-pytest: qa-env
. $(PYTHON_QA_ENV)/bin/activate && \
$(PYTHON) -m pytest -vv
qa-ruff: qa-env
. $(PYTHON_QA_ENV)/bin/activate && \
ruff format --check --diff && ruff check
qa-ruff-fix: qa-env
. $(PYTHON_QA_ENV)/bin/activate && \
ruff format && ruff check --fix