-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (58 loc) · 1.75 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
LENGTH=120
SRC=levin
SPID=
.PHONY: run
run:
python -m watchgod run.main
.PHONY: check
check:
curl --http2-prior-knowledge https://localhost:8000/test/ -H "Content-type: application/json"
.PHONY: profiling
profiling:
profiling -S run.py
.PHONY: frame
frame:
rm .pid
SPID="$(shell python run.py & echo $$!)"
echo $(SPID)
docker run --rm -d svagi/h2load -c 50 -n 20000 -m 10 -t 4 https://host.docker.internal:8000/
sudo py-spy -d 3 -f profile.svg -p $(SPID)
kill -9 $(SPID)
.PHONY: run
perf:
docker run --rm -it svagi/h2load -c 50 -n 20000 -m 10 -t 4 https://host.docker.internal:8000/-/
.PHONY: format
format: black isort
.PHONY: pylint
pylint:
pylint $(SRC) --reports=n --max-line-length=$(LENGTH)
.PHONY: isort
isort:
@echo -n "Run isort"
isort --lines $(LENGTH) -rc $(SRC) tests
.PHONY: black
black:
@echo -n "Run black"
black -l $(LENGTH) $(SRC) tests
.PHONY: check-isort
check-isort:
isort --lines $(LENGTH) -vb -rc --check-only -df $(SRC) tests
.PHONY: check-styles
check-styles:
pycodestyle $(SRC) tests --max-line-length=$(LENGTH) --format pylint --exclude=migrations
.PHONY: check-black
check-black:
black --check --diff -v -l $(LENGTH) $(SRC) tests
.PHONY: checks
checks: check-styles check-isort check-black pylint-score tests
.PHONY: tests
tests:
pytest -v --cov=$(SRC) -v --cov-report=xml --cov-report=term
.PHONY: pylint-score
pylint-score:
$(eval $@_SCORE := $(shell pylint --output-format=text --max-line-length=$(LENGTH) $(SRC) | sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p'))
@echo $($@_SCORE)
@if [ $(shell echo "$($@_SCORE) < 9.90" | bc) -eq 1 ]; then exit 1; fi
@anybadge --value=$($@_SCORE) -o --file=pylint.svg pylint
gen-cert:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes