-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
118 lines (80 loc) · 2.51 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
#!/usr/bin/make -f
DOCKER_COMPOSE_DEV = docker compose
DOCKER_COMPOSE_CI = docker compose -f docker-compose.yml
DOCKER_COMPOSE = $(DOCKER_COMPOSE_DEV)
VENV = venv
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python
PYTEST_WATCH_MODULES = tests/unit_test
venv-clean:
@if [ -d "$(VENV)" ]; then \
rm -rf "$(VENV)"; \
fi
venv-create:
python3 -m venv $(VENV)
dev-install:
$(PIP) install --disable-pip-version-check -r requirements.build.txt
$(PIP) install --disable-pip-version-check \
-r requirements.spacy.txt \
-r requirements.txt \
-r requirements.dev.txt
dev-nlp-model-download:
$(PYTHON) -m spacy download en_core_web_lg
$(PYTHON) -m spacy download en_core_web_md
$(PYTHON) -m spacy download en_core_web_sm
dev-venv: venv-create dev-install dev-nlp-model-download
dev-flake8:
$(PYTHON) -m flake8 spacy_keyword_extraction_api tests
dev-pylint:
$(PYTHON) -m pylint spacy_keyword_extraction_api tests
dev-mypy:
$(PYTHON) -m mypy --check-untyped-defs spacy_keyword_extraction_api tests
dev-lint: dev-flake8 dev-pylint dev-mypy
dev-unittest:
$(PYTHON) -m pytest -p no:cacheprovider $(ARGS) tests/unit_test
dev-test: dev-lint dev-unittest
dev-watch:
$(PYTHON) -m pytest_watcher \
--runner=$(VENV)/bin/python \
. \
-m pytest $(PYTEST_WATCH_MODULES)
dev-start:
$(PYTHON) -m uvicorn \
spacy_keyword_extraction_api.main:create_app \
--reload \
--factory \
--host 127.0.0.1 \
--port 8000 \
--log-config=config/logging.yaml
build:
$(DOCKER_COMPOSE) build spacy-keyword-extraction-api
build-dev:
$(DOCKER_COMPOSE) build spacy-keyword-extraction-api-dev
flake8:
$(DOCKER_COMPOSE) run --rm spacy-keyword-extraction-api-dev \
python -m flake8 spacy_keyword_extraction_api tests
pylint:
$(DOCKER_COMPOSE) run --rm spacy-keyword-extraction-api-dev \
python -m pylint spacy_keyword_extraction_api tests
mypy:
$(DOCKER_COMPOSE) run --rm spacy-keyword-extraction-api-dev \
python -m mypy --check-untyped-defs spacy_keyword_extraction_api tests
lint: flake8 pylint mypy
pytest:
$(DOCKER_COMPOSE) run --rm spacy-keyword-extraction-api-dev \
python -m pytest spacy_keyword_extraction_api tests
test: lint pytest
start:
$(DOCKER_COMPOSE) up -d spacy-keyword-extraction-api
stop:
$(DOCKER_COMPOSE) down
logs:
$(DOCKER_COMPOSE) logs -f
ci-build:
$(MAKE) DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" build
ci-build-dev:
$(MAKE) DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" build-dev
ci-lint:
$(MAKE) DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" lint
ci-unittest:
$(MAKE) DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" pytest