-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
87 lines (61 loc) · 1.68 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
.PHONY: install test typecheck unittest dev fmt fmt-check generate clean update-proto coverage build check push push-test
PYTHON := python
ifdef PROTO_VERSION
PROTO_TARGET := buf.build/stealthrocket/dispatch-proto:$(PROTO_VERSION)
else
PROTO_TARGET := buf.build/stealthrocket/dispatch-proto
endif
all: test
install:
$(PYTHON) -m pip install -e .
dev:
$(PYTHON) -m pip install -e .[dev]
lambda:
$(PYTHON) -m pip install -e .[lambda]
fmt:
$(PYTHON) -m isort .
$(PYTHON) -m black .
fmt-check:
@$(PYTHON) -m isort . --check --diff; isort_status=$$?; \
$(PYTHON) -m black . --check --diff; black_status=$$?; \
exit $$((isort_status + black_status))
typecheck:
$(PYTHON) -m mypy --check-untyped-defs src tests examples
unittest:
$(PYTHON) -m pytest tests
exampletest:
$(PYTHON) -m pytest examples
coverage: typecheck
coverage run -m unittest discover
coverage html -d .coverage-html
coverage report
test: typecheck unittest
.proto:
mkdir -p $@
.proto/dispatch-proto: .proto
buf export $(PROTO_TARGET) --output=.proto/dispatch-proto
update-proto:
$(MAKE) clean
find . -type f -name '*_pb2*.py*' -exec rm {} \;
$(MAKE) generate
generate: .proto/dispatch-proto
buf generate --template buf.gen.yaml
cd src && find . -type d | while IFS= read -r dir; do touch $$dir/__init__.py; done
rm src/__init__.py
$(MAKE) fmt
clean:
$(RM) -r dist .proto .coverage .coverage-html
find . -type f -name '*.pyc' | xargs $(RM) -r
find . -type d -name '__pycache__' | xargs $(RM) -r
build:
$(PYTHON) -m build
check:
twine check dist/*
push:
twine upload dist/*
push-test:
twine upload -r testpypi dist/*
docs-deps: dev
$(PYTHON) -m pip install .[docs]
local-docs: docs-deps
mkdocs serve