-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (50 loc) · 1.27 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
PYTHON=python3.10
VENV_BIN=.venv/bin
RUNTEST=$(PYTHON) -m unittest -v -b
ALLMODULES=$(patsubst %.py, %.py, $(wildcard test*.py))
.PHONY: prepare-venv
.ONESHELL:
prepare-venv: .SHELLFLAGS := -euo pipefail -c
prepare-venv: SHELL := bash
prepare-venv:
virtualenv --system-site-packages .venv
$(VENV_BIN)/pip install --ignore-installed --no-deps -r requirements.txt
.PHONY: format
format:
. .venv/bin/activate
$(VENV_BIN)/autoflake -i -r --ignore-init-module-imports swmjupyter
$(VENV_BIN)/black swmjupyter
$(VENV_BIN)/isort swmjupyter
.PHONY: check
check:
. .venv/bin/activate
$(VENV_BIN)/ruff check swmjupyter
$(VENV_BIN)/mypy swmjupyter
$(VENV_BIN)/bandit -r swmjupyter -c "pyproject.toml" --silent
.PHONY: package
package:
. .venv/bin/activate
$(PYTHON) -m build
.PHONY: clean
clean:
rm -fr ./dist
rm -fr swmjupyter.egg-info
rm -fr build
.PHONY: upload
upload:
. .venv/bin/activate
$(PYTHON) -m twine upload --verbose --config-file .pypirc dist/*
.PHONY: test
test:
${RUNTEST} ${ALLMODULES}
% : test%.py
${RUNTEST} test$@
.PHONY: update-client-package
update-client-package:
. .venv/bin/activate
pip install --upgrade -e ../swm-python-client
.PHONY: requirements
requirements: requirements.txt
make prepare-venv || true
requirements.txt: requirements.in
@pip-compile $<