-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (49 loc) · 1.7 KB
/
Copy pathMakefile
File metadata and controls
59 lines (49 loc) · 1.7 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
CPU_VENV = qlbm-cpu-venv
GPU_VENV = qlbm-gpu-venv
PYTHON ?= python3
.PHONY: clean check-python-version install-cpu install-gpu ruff mypy test check-ci
clean:
rm -rf $(CPU_VENV)
rm -rf $(GPU_VENV)
find . -type f -name "*.pyc" -exec rm -f {} \;
check-python-version:
@PYTHON_VERSION=$$($(PYTHON) --version 2>&1 | awk '{print $$2}'); \
MAJOR_VERSION=$$(echo $$PYTHON_VERSION | cut -d. -f1); \
MINOR_VERSION=$$(echo $$PYTHON_VERSION | cut -d. -f2); \
if [ "$$MAJOR_VERSION" -ne 3 ] || [ "$$MINOR_VERSION" -lt 12 ] || [ "$$MINOR_VERSION" -gt 13 ]; then \
echo "Python version must be between 3.12 and 3.13"; \
exit 1; \
fi
install-cpu: check-python-version pyproject.toml
@ echo "Creating CPU venv..."
$(PYTHON) -m venv $(CPU_VENV)
@ echo "Installing dependencies [CPU]..."
$(CPU_VENV)/bin/python -m pip install --upgrade pip
$(CPU_VENV)/bin/pip install -e .[cpu,dev]
@ echo "Installation successful!"
install-gpu: check-python-version pyproject.toml
@ echo "Creating GPU venv..."
$(PYTHON) -m venv $(GPU_VENV)
@ echo "Installing dependencies [GPU]..."
$(GPU_VENV)/bin/python -m pip install --upgrade pip
$(GPU_VENV)/bin/pip install -e .[gpu,dev]
@ echo "Installation successful!"
ruff:
@ echo Running Ruff...
$(CPU_VENV)/bin/ruff check qlbm
@ echo Ruff was successful.
mypy:
@ echo Running Mypy...
$(CPU_VENV)/bin/mypy qlbm test --config-file pyproject.toml
@ echo Mypy was successful
test:
@ echo Running pytest...
$(CPU_VENV)/bin/pytest test/unit --junitxml=pytest_report.xml
@ echo All tests were successful.
doctest:
@ echo Building docs...
make -C docs doctest
make -C docs html
@ echo Docs were built successfully.
check-ci: ruff mypy test doctest
@ echo "CI checks passed successfully."