-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (58 loc) · 2.52 KB
/
Copy pathMakefile
File metadata and controls
73 lines (58 loc) · 2.52 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
SHELL := /bin/bash
PYTHON ?= $(shell which python)
CONDA_ENV := spatial-adapter
ACTIVATE := source $$(conda info --base)/etc/profile.d/conda.sh && conda activate $(CONDA_ENV)
.PHONY: clean install install-dev install-all build-cpp test test-cov test-fast \
test-gpu lint format jupyter conda-env help
# Installation
install: ## Install core library (editable)
@$(ACTIVATE) && pip install -e .
install-dev: ## Install with dev tools (pytest, black, etc.)
@$(ACTIVATE) && pip install -e ".[dev]"
install-all: ## Install everything (vision + forecasting + interactive + dev)
@$(ACTIVATE) && pip install -e ".[all]"
# C++ extensions
build-cpp: ## Build pybind11 C++ extensions (spatial_utils.so)
@echo "Building C++ extensions..."
@$(ACTIVATE) && \
cd spatial_adapter/cpp_extensions && \
rm -rf build spatial_utils.so && \
mkdir -p build && cd build && \
cmake \
-DCMAKE_PREFIX_PATH=$$CONDA_PREFIX \
-DCMAKE_INCLUDE_PATH=$$CONDA_PREFIX/include \
-DCMAKE_LIBRARY_PATH=$$CONDA_PREFIX/lib \
-DCMAKE_BUILD_TYPE=Release .. && \
make -j$$(nproc) && \
cd ../.. && \
python -c "from spatial_adapter.cpp_extensions import spatial_utils; print('C++ extensions OK')"
# Testing
test: ## Run all tests with coverage
@$(ACTIVATE) && python -m pytest
test-cov: ## Run tests with HTML coverage report
@$(ACTIVATE) && python -m pytest --cov-report=html
test-fast: ## Run non-slow tests only
@$(ACTIVATE) && python -m pytest -m "not slow"
test-gpu: ## Run GPU-only tests
@$(ACTIVATE) && python -m pytest -m "gpu"
# Code quality
lint: ## Run flake8 + mypy
@$(ACTIVATE) && flake8 spatial_adapter/ tests/ && mypy spatial_adapter/
format: ## Auto-format with black + isort
@$(ACTIVATE) && black spatial_adapter/ tests/ && isort spatial_adapter/ tests/
# Environment
conda-env: ## Create conda env + build C++ extensions
@bash envs/conda/build_conda_env.sh
@make build-cpp
jupyter: ## Start Jupyter Lab
@$(SHELL) envs/jupyter/start_jupyter_lab.sh --port 8501
# Cleanup
clean: ## Remove build artifacts, caches, coverage
@find . -type f -name '*.py[co]' -delete
@find . -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name '.ipynb_checkpoints' -exec rm -rf {} + 2>/dev/null || true
@rm -rf build/ dist/ *.egg-info .eggs/ .pytest_cache/ htmlcov/ .coverage
# Help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'