-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (48 loc) · 1.67 KB
/
Makefile
File metadata and controls
57 lines (48 loc) · 1.67 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
SHELL := /bin/bash
# Variables
PYTHON := python
UV := $(PYTHON) -m uv
PIP := $(UV) pip
PYTEST := $(PYTHON) -m pytest
# Parallel job count for compilation
JOBS := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
# Directories
SRC_DIR := rugo
TEST_DIR := tests
define print_green
@echo -e "\033[0;32m$(1)\033[0m"
endef
define print_blue
@echo -e "\033[0;34m$(1)\033[0m"
endef
lint: ## Run all linting tools
$(call print_blue,"Installing linting tools...")
@$(PIP) install --quiet --upgrade pycln isort ruff yamllint cython-lint
$(call print_blue,"Running Cython lint...")
@cython-lint $(SRC_DIR)/compiled/**/*.pyx || true
$(call print_blue,"Running Ruff checks...")
@$(PYTHON) -m ruff check --fix --exit-zero
$(call print_blue,"Cleaning unused imports...")
@$(PYTHON) -m pycln .
$(call print_blue,"Sorting imports...")
@$(PYTHON) -m isort .
$(call print_blue,"Formatting code...")
@$(PYTHON) -m ruff format $(SRC_DIR)
$(call print_green,"Linting complete!")
test: dev-install ## Run full test suite
$(call print_blue,"Running full test suite...")
@$(PIP) install --upgrade pytest pytest-xdist
@clear
@$(PYTEST) -n auto --color=yes
compile: ## Compile Cython extensions
$(call print_blue,"Compiling Cython extensions...")
@$(PIP) install --upgrade pip uv numpy cython setuptools
@find . -name '*.so' -delete
@rm -rf build dist *.egg-info
@$(PYTHON) setup.py clean
@$(PYTHON) setup.py build_ext --inplace -j $(JOBS)
$(call print_green,"Compilation complete!")
dev-install: ## Install development dependencies
$(call print_blue,"Installing development dependencies...")
@$(PIP) install --upgrade pip uv
@$(PIP) install --upgrade -r tests/requirements.txt