-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 1.58 KB
/
Makefile
File metadata and controls
59 lines (46 loc) · 1.58 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
VENV := venv
PYTHON := $(VENV)/bin/python
RUFF := $(VENV)/bin/ruff
MYPY := $(VENV)/bin/mypy
PYTEST := $(VENV)/bin/pytest
PRECOMMIT := $(VENV)/bin/pre-commit
# Match CI: single-threaded math and CPU feature caps for reproducible tests
TEST_ENV := \
OMP_NUM_THREADS=1 OMP_THREAD_LIMIT=1 OMP_DYNAMIC=FALSE \
MKL_NUM_THREADS=1 MKL_DYNAMIC=FALSE \
OPENBLAS_NUM_THREADS=1 GOTO_NUM_THREADS=1 \
NUMEXPR_NUM_THREADS=1 NUMBA_NUM_THREADS=1 \
PYTHON_CPU_COUNT=1 VECLIB_MAXIMUM_THREADS=1 \
NPY_DISABLE_CPU_FEATURES=X86_V4,AVX512F,AVX512CD,AVX512_SKX,AVX512_CLX,AVX512_CNL,AVX512_ICL,AVX512_SPR \
OPENBLAS_CORETYPE=HASWELL
.PHONY: lint format typecheck test test-cov build docs pre-commit all help
help:
@echo "Available targets:"
@echo " lint Run ruff linter over src/ and tests/"
@echo " format Run ruff formatter over src/ and tests/"
@echo " typecheck Run mypy type checker over src/pyoptex/"
@echo " test Run pytest"
@echo " test-cov Run pytest with coverage report"
@echo " build Build distribution wheels"
@echo " docs Build Sphinx HTML docs"
@echo " pre-commit Run all pre-commit hooks on all files"
@echo " all Run lint, typecheck, and test"
lint:
$(RUFF) check src/ tests/
format:
$(RUFF) format src/ tests/
typecheck:
$(MYPY) src/pyoptex/
capture-references:
$(TEST_ENV) python tests/_capture_references.py
test:
$(TEST_ENV) $(PYTEST)
test-cov:
$(TEST_ENV) $(PYTEST) --cov=pyoptex --cov-report=term-missing
build:
$(PYTHON) -m build
docs:
$(MAKE) -C docs html
pre-commit:
$(PRECOMMIT) run --all-files
all: lint typecheck test