Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (58 loc) · 1.6 KB
/
Copy pathMakefile
File metadata and controls
71 lines (58 loc) · 1.6 KB
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
PYTHON=python3.12
VENV_BIN=.venv/bin
.PHONY: prepare-venv
.ONESHELL:
prepare-venv: .SHELLFLAGS := -euo pipefail -c
prepare-venv: SHELL := bash
prepare-venv:
# Recreate cleanly: a stale .venv can leave python -> python3.12 with a missing target.
$(PYTHON) -m venv --clear .venv
test -x $(VENV_BIN)/python
$(VENV_BIN)/python -m pip install --upgrade pip
$(VENV_BIN)/python -m pip install --ignore-installed --no-deps -r requirements.txt
$(VENV_BIN)/python -m pip install -e ".[test]"
# PyPI swmclient may lag local (e.g. purge_jobs); prefer sibling checkout when present.
if [ -d ../swm-python-client ]; then
$(VENV_BIN)/python -m pip install -e ../swm-python-client
fi
.PHONY: format
format:
. .venv/bin/activate
$(VENV_BIN)/autoflake -i -r --ignore-init-module-imports swmconsole
$(VENV_BIN)/black swmconsole
$(VENV_BIN)/isort swmconsole
.PHONY: check
check:
. .venv/bin/activate
$(VENV_BIN)/flake8 swmconsole
$(VENV_BIN)/mypy swmconsole
.PHONY: test
test:
. .venv/bin/activate
$(VENV_BIN)/python -m pytest -q tests
.PHONY: act
act:
scripts/run-act.sh $(ARGS)
.PHONY: update-client-package
update-client-package:
. .venv/bin/activate
$(VENV_BIN)/python -m pip install --upgrade -e ../swm-python-client
.PHONY: requirements
requirements: requirements.txt
make prepare-venv || true
requirements.txt: requirements.in
@pip-compile $<
.PHONY: package
package:
. .venv/bin/activate
$(PYTHON) -m build
.PHONY: upload
upload:
. .venv/bin/activate
$(PYTHON) -m twine upload --verbose --config-file .pypirc dist/*
.PHONY: clean
clean:
rm -fr ./dist
rm -fr swmconsole.egg-info
rm -fr build
rm -fr .venv