-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (69 loc) · 2.7 KB
/
Copy pathMakefile
File metadata and controls
99 lines (69 loc) · 2.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
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
SHELL := /bin/bash
PYTHON := $(shell command -v python3 2>/dev/null || command -v python)
VENV_DIR := .venv
# Determine the correct activation script path based on the OS
ifeq ($(OS), Windows_NT)
VENV_ACTIVATE := $(VENV_DIR)/Scripts/activate
else
VENV_ACTIVATE := $(VENV_DIR)/bin/activate
endif
.PHONY: help venv clean purge build lint py-test rust-test test fmt
# This target ensures the virtual environment exists before any python commands run.
venv:
@if [ ! -d "$(VENV_DIR)" ]; then \
echo "Creating virtual environment with uv..."; \
$(PYTHON) -m uv venv $(VENV_DIR); \
fi
help: ## List all options
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
init: venv ## Initialise local resources for testing the software
@echo "Installing Python dependencies..."
@cp "README.md" "package-python/README_PYTHON.md"
@cp "LICENSE" "package-python/LICENSE"
@source $(VENV_ACTIVATE) && \
cd package-python && \
uv pip install -e ".[dev]" && \
cd .. && \
uv pip install pandas seaborn && \
python scripts/make_resources.py
@echo "Installing pre-commit hooks..."
@source $(VENV_ACTIVATE) && \
uv pip install pre-commit && \
pre-commit install
clean: ## Clean the project using cargo
cargo clean
purge: ## Delete everything that is NOT tracked by git
git clean -d -x -f
build: ## Build the project using cargo
cargo build
lint: ## Lint the project using cargo
@rustup component add clippy 2> /dev/null
cargo clippy
py-test-sh: venv ## Test the projects Python implementation
@echo "Running Python tests..."
@source $(VENV_ACTIVATE) && \
bash scripts/run-python-tests.sh
py-test-ps: venv ## Test the projects Python implementation
@echo "Running Python tests..."
@source $(VENV_ACTIVATE) && \
powershell.exe -ExecutionPolicy Bypass -File scripts/run-python-tests.ps1
py-test-ps-single: venv ## Test the projects Python implementation
@echo "Running Python tests..."
@source $(VENV_ACTIVATE) && \
powershell.exe -ExecutionPolicy Bypass -File scripts/run-single-python-test.ps1
rust-test: ## Test the projects Rust implementation
cargo test
test: venv ## Test the project and all its implementations
@echo "Running both Rust and Python tests..."
cargo test
@source $(VENV_ACTIVATE) && \
bash scripts/run-python-tests.sh
fmt: ## Format the project using cargo
@rustup component add rustfmt 2> /dev/null
cargo fmt
vendor-r: ## Vendor core Rust logic into the R package
@echo "Vendoring core Rust logic..."
$(PYTHON) scripts/vendor_r.py
gen-r-docs: ## Generate R documentation using roxygen2
@echo "Generating R documentation..."
Rscript scripts/generate_r_docs.R