-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
137 lines (114 loc) · 3.19 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
DIRS_PYTHON := src tests docs
.PHONY: help
help:
@echo "Usage: make <target>"
@echo
@echo "Targets:"
@echo " help This help (default target)"
@echo " deps Install all dependencies"
@echo " ci-docs-deps Install all dependencies for docs in CI"
@echo " format Format source code"
@echo " lint Run lint checks"
@echo " serve Run the API application"
@echo " bench Run the benchmark"
@echo " test-remote Run remote tests"
@echo " test Run tests"
@echo " test-all Run all tests"
@echo " ci-unit-test Run unit tests in CI"
@echo " ci-e2e-test Run end-to-end tests in CI"
@echo " ci Install dependencies, run lints and tests"
@echo " docs Generate the documentation"
@echo " ci-docs Generate the documentation in CI"
.PHONY: deps
deps:
pipenv install --dev
.PHONY: ci-docs-deps
ci-docs-deps:
python -m pip install --upgrade --no-cache-dir pip setuptools
python -m pip install --upgrade --no-cache-dir sphinx readthedocs-sphinx-ext
python -m pip install --no-cache-dir -r docs/requirements.txt
.PHONY: format
format: \
format-ruff \
format-isort
.PHONY: format-ruff
format-ruff:
pipenv run ruff format --line-length 100 $(DIRS_PYTHON)
.PHONY: format-isort
format-isort:
pipenv run isort --profile=black --line-length 100 $(DIRS_PYTHON)
.PHONY: lint
lint: \
lint-ruff \
lint-isort \
lint-mypy
.PHONY: lint-ruff
lint-ruff:
pipenv run ruff check --line-length 100 $(DIRS_PYTHON)
.PHONY: lint-isort
lint-isort:
pipenv run isort --profile=black --line-length 100 --check-only --diff $(DIRS_PYTHON)
.PHONY: lint-mypy
lint-mypy:
pipenv run mypy --check-untyped-defs $(DIRS_PYTHON)
.PHONY: serve
serve:
pipenv run uvicorn src.main:app --host 0.0.0.0 --port 8080 --reload --workers 8
.PHONY: bench
bench:
pipenv run python -m src.bench.comparison_v4
.PHONY: test-remote
test-remote:
pipenv run pytest \
-m "remote" \
--record-mode=new_episodes \
tests/
.PHONY: test
test:
pipenv run pytest \
-m "not remote" \
--record-mode=new_episodes \
tests/
.PHONY: test-all
test-all:
pipenv run pytest \
--record-mode=new_episodes \
tests/
.PHONY: ci-unit-test
ci-unit-test:
pipenv run pytest \
-m "not remote" \
--cov-report term-missing \
--cov-report lcov \
--cov=src \
tests/
.PHONY: ci-e2e-test
ci-e2e-test:
pipenv run pytest \
-m "remote" \
--record-mode=new_episodes \
--capture=no \
tests/
.PHONY: docs
docs:
PYTHONPATH=$(PWD) pipenv run -- make -C docs clean html
.PHONY: ci-docs
ci-docs:
make -C docs clean html 2>&1 | tee sphinx-output.log | grep -q "ERROR" && exit 1 || exit 0
.PHONY: jupyternotebook
jupyternotebook:
pipenv run \
jupyter notebook
.PHONY: jupyterlab
jupyterlab:
cp src/bench/results_analysis.ipynb tmp.ipynb && \
PYTHON=. pipenv run \
jupyter lab \
--ip=0.0.0.0 --allow-root --NotebookApp.custom_display_url=http://127.0.0.1:8888 \
tmp.ipynb
.PHONY: dump-openapi
dump-openapi:
pipenv run python -c 'from src.utils import dump_openapi_yaml; dump_openapi_yaml("openapi.yaml")'
.PHONY: ci-dump-openapi
ci-dump-openapi:
pipenv run python -c 'from src.utils import dump_openapi_yaml; dump_openapi_yaml("ci-openapi.yaml")'