-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
56 lines (45 loc) · 1.98 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
help:
@echo "The following make targets are available:"
@echo "install install the library for local development (this is not meant for installing it to be used elsewhere)"
@echo "lint-type-check run type check"
@echo "lint-pylint run linter check using pylint standard"
@echo "lint-all run all lints"
@echo "git-check ensure that the working directory is clean"
@echo "pack build the library"
@echo "publish publish the library on pypi"
@echo "run-test run all tests"
@echo "pre-commit sort python package imports using isort"
export LC_ALL=C
export LANG=C
PYTHON?=python
VERSION?=`echo "import tomllib;print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])" | python 2>/dev/null`
install:
$(PYTHON) -m pip install --progress-bar off --upgrade pip
$(PYTHON) -m pip install --progress-bar off --upgrade mypy pylint pre-commit importlib types-requests
$(PYTHON) -m pip install --progress-bar off --upgrade -e .
lint-type-check:
$(PYTHON) -m mypy src/
lint-pylint:
sh/findpy.sh | sort
sh/findpy.sh | sort | xargs $(PYTHON) -m pylint -j 6 -v
lint-all: \
lint-pylint \
lint-type-check
git-check:
@git diff --exit-code 2>&1 >/dev/null && git diff --cached --exit-code 2>&1 >/dev/null || (echo "working copy is not clean" && exit 1)
@test -z `git ls-files --other --exclude-standard --directory` || (echo "there are untracked files" && exit 1)
@test `git rev-parse --abbrev-ref HEAD` = "master" || (grep -q -E "a|b|rc" <<< "$(VERSION)") || (echo "not on master" && exit 1)
pack:
$(PYTHON) -m pip install --progress-bar off --upgrade setuptools twine wheel
rm -r dist build src/quick_server.egg-info || echo "no files to delete"
$(PYTHON) setup.py sdist bdist_wheel
publish: git-check pack
$(PYTHON) -m twine upload dist/quick_server-$(VERSION)-py3-none-any.whl dist/quick_server-$(VERSION).tar.gz
git tag "v$(VERSION)"
git push origin "v$(VERSION)"
@echo "successfully deployed $(VERSION)"
run-test:
$(PYTHON) test/run.py $(SKIP)
pre-commit:
pre-commit install
isort .