-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
274 lines (233 loc) · 7.55 KB
/
Makefile
File metadata and controls
274 lines (233 loc) · 7.55 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# ------------------------------------
# Customized func / var define
# ------------------------------------
HAS_POETRY := $(shell command -v poetry 2> /dev/null)
POETRY_VERSION := $(shell poetry version $(shell git describe --tags --abbrev=0))
# ------------------------------------
# Test
# ------------------------------------
.PHONY: test
## Run ALL tests in parallel with optimizations
test:
poetry run pytest -c pytest-fast.ini
.PHONY: test-fast
## Run only fast tests in parallel
test-fast:
poetry run pytest -m "fast or unit" --maxfail=5
.PHONY: test-all
## Run ALL tests (unit, integration, layers, everything) with optimizations
test-all:
poetry run pytest -c pytest-fast.ini --cov=kdp --cov-report=term-missing --cov-report=html
.PHONY: test-slow
## Run slow and integration tests
test-slow:
poetry run pytest -m "slow or integration" --maxfail=3
.PHONY: test-unit
## Run unit tests only
test-unit:
poetry run pytest -m "unit" --maxfail=10
.PHONY: test-integration
## Run integration tests only
test-integration:
poetry run pytest -m "integration" --maxfail=3
.PHONY: test-layers
## Run layer-specific tests
test-layers:
poetry run pytest -m "layers" --maxfail=5
.PHONY: test-processor
## Run processor-specific tests
test-processor:
poetry run pytest -m "processor" --maxfail=3
.PHONY: test-time-series
## Run time series tests
test-time-series:
poetry run pytest -m "time_series" --maxfail=3
.PHONY: test-sequential
## Run tests sequentially (no parallel execution)
test-sequential:
poetry run pytest -n 0
.PHONY: test-verbose
## Run tests with verbose output
test-verbose:
poetry run pytest -v --tb=long
.PHONY: test-benchmark
## Run performance benchmark tests
test-benchmark:
poetry run pytest -m "performance" --benchmark-only
.PHONY: test-smoke
## Run a quick smoke test (fastest tests only)
test-smoke:
poetry run pytest -m "fast" --maxfail=1 --tb=no -q
.PHONY: test-ultrafast
## Run tests with ultra-fast configuration (may be unstable)
test-ultrafast:
poetry run pytest -c pytest-ultrafast.ini
.PHONY: test-fast-balanced
## Run tests with balanced fast configuration
test-fast-balanced:
poetry run pytest -c pytest-fast.ini
.PHONY: test-micro
## Run only micro tests (fastest possible)
test-micro:
poetry run pytest -m "micro" --maxfail=1 --tb=no -q --timeout=30
.PHONY: test-parallel-max
## Run tests with maximum parallelization
test-parallel-max:
poetry run pytest -n logical --maxfail=3 --tb=no -q --timeout=90
.PHONY: unittests
## Run unittests (legacy command, use 'test' instead)
unittests: test
.PHONY: clean_tests
## Remove pytest cache and test artifacts
clean_tests:
find . -type d -name .pytest_cache -exec rm -r {} +
find . -type d -name __pycache__ -exec rm -r {} +
find . -type f -name '*junit_report.xml' -exec rm {} +
find . -type f -name '*.pyc' -exec rm {} +
rm -rf htmlcov/
rm -f .coverage
rm -f coverage.xml
rm -f pytest.xml
.PHONY: coverage
## Generate coverage report
coverage:
poetry run pytest --cov-report=html --cov-report=term-missing
@echo "Coverage report generated in htmlcov/index.html"
# ------------------------------------
# Build package
# ------------------------------------
.PHONY: build_pkg
## Build the package using poetry
build_pkg:
@echo "Start to build pkg"
ifdef HAS_POETRY
@$(POETRY_VERSION)
poetry build
else
@echo "To build the package, you need to have poetry first"
exit 1
endif
.PHONY: build
## Clean up cache from previous built, and build the package
build: clean_built build_pkg
.PHONY: clean_built
## Remove cache, built package, and docs directories after build or installation
clean_built:
find . -type d -name dist -exec rm -r {} +
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
# ------------------------------------
# Build doc
# ------------------------------------
.PHONY: generate_all_diagrams
## Generate all diagrams, organize them, and clean up in one command
generate_all_diagrams:
@echo "Generating and organizing all diagrams in one step"
./scripts/generate_all_diagrams.sh
.PHONY: generate_doc_content
## Generate documentation content from code and model architectures (DEPRECATED - use generate_all_diagrams instead)
generate_doc_content:
@echo "NOTE: This target is deprecated. Please use 'make generate_all_diagrams' instead."
@echo "Generating API documentation from docstrings"
mkdir -p docs/generated/api
poetry run python scripts/generate_docstring_docs.py
@echo "Generating model architecture diagrams"
mkdir -p docs/features/imgs/models
poetry run python scripts/generate_model_diagrams.py
@echo "Organizing documentation images"
./scripts/organize_docs_images.sh
@echo "Documentation content generation complete"
.PHONY: docs_deploy
## Build docs using mike
docs_deploy: generate_all_diagrams
@echo "Starting to build docs"
@echo "more info: https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/"
ifdef HAS_POETRY
@$(POETRY_VERSION)
poetry version -s | xargs -I {} sh -c 'echo Deploying version {} && mike deploy --push --update-aliases {} latest'
else
@echo "To build the docs, you need to have poetry first"
exit 1
endif
.PHONY: docs_version_list
## List available versions of the docs
docs_version_list:
mike list
.PHONY: docs_version_serve
## Serve versioned docs
docs_version_serve:
@echo "Start to serve versioned docs"
mike serve
.PHONY: docs
## Create or Deploy MkDocs based documentation to GitHub pages.
deploy_doc: generate_all_diagrams
mkdocs gh-deploy
.PHONY: serve_doc
## Test MkDocs based documentation locally.
serve_doc: generate_all_diagrams
poetry run mkdocs serve
# ------------------------------------
# Clean All
# ------------------------------------
.PHONY: identify_unused_diagrams
## Identify potentially unused diagram files
identify_unused_diagrams:
@echo "Scanning for potentially unused diagram files"
poetry run python scripts/cleanup_unused_diagrams.py
@echo "Scan complete. Check unused_diagrams_report.txt for details"
.PHONY: clean_old_diagrams
## Remove obsolete diagram directories and unused diagram files
clean_old_diagrams: identify_unused_diagrams
@echo "Cleaning up old diagram directories"
rm -rf docs/imgs/architectures
@echo "Organizing documentation images"
./scripts/organize_docs_images.sh
@echo "Old diagram directories cleaned up"
@echo "NOTE: Review unused_diagrams_report.txt to identify additional files to remove manually"
.PHONY: clean
## Remove cache, built package, and docs directories after build or installation
clean: clean_old_diagrams
find . -type d -name dist -exec rm -r {} +
find . -type f -name '*.rst' ! -name 'index.rst' -delete
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
# ------------------------------------
# Default
# ------------------------------------
.DEFAULT_GOAL := help
help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
@echo
@sed -n -e "/^## / { \
h; \
s/.*//; \
:doc" \
-e "H; \
n; \
s/^## //; \
t doc" \
-e "s/:.*//; \
G; \
s/\\n## /---/; \
s/\\n/ /g; \
p; \
}" ${MAKEFILE_LIST} \
| LC_ALL='C' sort --ignore-case \
| awk -F '---' \
-v ncol=$$(tput cols) \
-v indent=19 \
-v col_on="$$(tput setaf 6)" \
-v col_off="$$(tput sgr0)" \
'{ \
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
n = split($$2, words, " "); \
line_length = ncol - indent; \
for (i = 1; i <= n; i++) { \
line_length -= length(words[i]) + 1; \
if (line_length <= 0) { \
line_length = ncol - indent - length(words[i]) - 1; \
printf "\n%*s ", -indent, " "; \
} \
printf "%s ", words[i]; \
} \
printf "\n"; \
}' \
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')