-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
77 lines (56 loc) · 1.67 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
VIRTUAL_ENV ?= env
PACKAGE ?= asgi_tools
all: $(VIRTUAL_ENV)
$(VIRTUAL_ENV): pyproject.toml .pre-commit-config.yaml
@[ -d $(VIRTUAL_ENV) ] || python -m venv $(VIRTUAL_ENV)
@$(VIRTUAL_ENV)/bin/pip install -e .[tests,dev,examples,docs]
@$(VIRTUAL_ENV)/bin/pre-commit install
@touch $(VIRTUAL_ENV)
VPART ?= minor
.PHONY: release
release: $(VIRTUAL_ENV)
git checkout develop
git pull
git checkout master
git pull
git merge develop
$(VIRTUAL_ENV)/bin/bump2version $(VPART)
git checkout develop
git merge master
git push --tags origin develop master
.PHONY: minor
minor:
make release VPART=minor
.PHONY: patch
patch:
make release VPART=patch
.PHONY: major
major:
make release VPART=major
.PHONY: clean
# target: clean - Display callable targets
clean:
rm -rf build/ dist/ docs/_build *.egg-info $(PACKAGE)/*.c $(PACKAGE)/*.so $(PACKAGE)/*.html
find $(CURDIR) -name "*.py[co]" -delete
find $(CURDIR) -name "*.orig" -delete
find $(CURDIR) -name "__pycache__" | xargs rm -rf
.PHONY: docs
docs: $(VIRTUAL_ENV)
rm -rf docs/_build/html
make -C docs html
LATEST_BENCHMARK = $(shell ls -t .benchmarks/* | head -1 | head -c4)
test t: cyt $(VIRTUAL_ENV)
$(VIRTUAL_ENV)/bin/pytest tests --benchmark-autosave --benchmark-compare=$(LATEST_BENCHMARK)
lint: $(VIRTUAL_ENV)
$(VIRTUAL_ENV)/bin/mypy
$(VIRTUAL_ENV)/bin/ruff $(PACKAGE)
mypy: $(VIRTUAL_ENV)
$(VIRTUAL_ENV)/bin/mypy
EXAMPLE = rates
example: $(VIRTUAL_ENV)
$(VIRTUAL_ENV)/bin/uvicorn --loop asyncio --port 5000 --reload examples.$(EXAMPLE):app
$(PACKAGE)/%.c: $(PACKAGE)/%.pyx
$(VIRTUAL_ENV)/bin/cython -a $<
cyt: $(PACKAGE)/multipart.c $(PACKAGE)/forms.c
compile: cyt
$(VIRTUAL_ENV)/bin/python setup.py build_ext --inplace