-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
175 lines (141 loc) · 6.13 KB
/
Makefile
File metadata and controls
175 lines (141 loc) · 6.13 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# PyMaSC Development Makefile
# This is a convenience wrapper for common development tasks
# For C source generation from Cython files, see Makefile.sources
.PHONY: test test-quick test-all test-integration test-unit test-parallel test-quick-parallel test-all-parallel test-integration-parallel test-unit-parallel test-workers build build-force rebuild install install-dev install-test clean sources sources-parallel bitarray-lib bitarray-clean help
# Default target
help:
@echo "PyMaSC Development Commands:"
@echo " make test - Run full test suite with coverage"
@echo " make test-quick - Run unit tests only (fast)"
@echo " make test-unit - Run unit tests verbosely"
@echo " make test-integration - Run integration tests"
@echo " make test-all - Run all tests verbosely with coverage"
@echo ""
@echo "Parallel test commands (requires pytest-xdist):"
@echo " make test-parallel - Run full test suite with coverage in parallel"
@echo " make test-quick-parallel - Run unit tests only in parallel (fast)"
@echo " make test-unit-parallel - Run unit tests verbosely in parallel"
@echo " make test-integration-parallel - Run integration tests in parallel"
@echo " make test-all-parallel - Run all tests verbosely in parallel with coverage"
@echo " make test-workers WORKERS=N - Run tests with N parallel workers"
@echo " make build - Build Cython extensions in-place (incremental)"
@echo " make build-force - Force rebuild all Cython extensions"
@echo " make rebuild - Complete rebuild (clean + force build)"
@echo " make install - Install package in development mode"
@echo " make install-dev - Install with all development dependencies"
@echo " make install-test - Install with testing dependencies"
@echo " make clean - Remove build artifacts and caches"
@echo " make sources - Generate C sources from .pyx files"
@echo " make sources-parallel - Generate C sources in parallel"
@echo " make bitarray-lib - Build BitArray library"
@echo " make bitarray-clean - Clean BitArray library"
@echo ""
@echo "For detailed C source generation options:"
@echo " make -f Makefile.sources help"
# Run tests with coverage (default test command)
test:
python -m pytest tests/ --verbose --tb=short --cov=PyMaSC --cov-report=term-missing --cov-report=html
# Quick test run (unit tests only, no coverage)
test-quick:
python -m pytest tests/unit/ -v
# Run unit tests verbosely
test-unit:
python -m pytest tests/unit/ -v
# Run integration tests
test-integration:
python -m pytest tests/integration/ -v
# Run all tests verbosely with coverage
test-all:
python -m pytest tests/ -v --cov=PyMaSC --cov-report=term-missing --cov-report=html
# Parallel test commands (using pytest-xdist)
# Run tests with coverage in parallel (auto-detect CPU count)
test-parallel:
python -m pytest tests/ --verbose --tb=short --cov=PyMaSC --cov-report=term-missing --cov-report=html -n auto --dist=loadgroup
# Quick parallel test run (unit tests only, no coverage)
test-quick-parallel:
python -m pytest tests/unit/ -v -n auto
# Run unit tests verbosely in parallel
test-unit-parallel:
python -m pytest tests/unit/ -v -n auto
# Run integration tests in parallel with subprocess test grouping
test-integration-parallel:
python -m pytest tests/integration/ -v -n auto --dist=loadgroup
# Run all tests verbosely in parallel with subprocess test grouping and coverage
test-all-parallel:
python -m pytest tests/ -v --cov=PyMaSC --cov-report=term-missing --cov-report=html -n auto --dist=loadgroup
# Run tests with custom number of workers
# Usage: make test-workers WORKERS=4
test-workers:
@if [ -z "$(WORKERS)" ]; then \
echo "Usage: make test-workers WORKERS=<number>"; \
echo "Example: make test-workers WORKERS=4"; \
exit 1; \
fi
python -m pytest tests/ -v -n $(WORKERS) --dist=loadgroup
# Build Cython extensions in-place
build: bitarray-lib
python setup.py build_ext --inplace
# Force rebuild all Cython extensions (for dependency changes)
build-force: bitarray-clean bitarray-lib
python setup.py build_ext --inplace --force
# Build BitArray library with correct architecture
bitarray-lib:
@echo "Building BitArray library..."
cd external/BitArray && make libbitarr.a
# Clean BitArray library
bitarray-clean:
@echo "Cleaning BitArray library..."
cd external/BitArray && make clean
# Complete rebuild (clean + force build)
rebuild: clean build-force
# Install package in development mode
install:
pip install -e .
# Install for development with all dependencies
install-dev:
pip install -e .[dev]
# Install for testing only
install-test:
pip install -e .[test]
# Clean build artifacts and caches
clean: bitarray-clean
# Remove Python caches
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
find . -type f -name "*.pyo" -delete 2>/dev/null || true
# Remove build directories
rm -rf build/ dist/ *.egg-info
# Remove coverage data
rm -rf htmlcov/ .coverage .coverage.*
# Remove pytest cache
rm -rf .pytest_cache/
# Remove compiled Cython extensions
find PyMaSC -name "*.so" -delete 2>/dev/null || true
# Remove C files but preserve version-specific ones (*_38.c, *_39.c, *_310.c, *_311.c, *_312.c, *_313.c)
find PyMaSC -name "*.c" ! -name "*_38.c" ! -name "*_39.c" ! -name "*_310.c" ! -name "*_311.c" ! -name "*_312.c" ! -name "*_313.c" -delete 2>/dev/null || true
@echo "Clean complete."
# Generate C sources from Cython files
sources:
$(MAKE) -f Makefile.sources all
# Generate C sources in parallel
sources-parallel:
$(MAKE) -f Makefile.sources parallel
# Additional useful targets
# Run specific test file
test-%:
python -m pytest tests/unit/test_$*.py -v
# Run tests matching a pattern
test-match:
@if [ -z "$(PATTERN)" ]; then \
echo "Usage: make test-match PATTERN=<pattern>"; \
echo "Example: make test-match PATTERN=golden"; \
exit 1; \
fi
python -m pytest tests/ -k "$(PATTERN)" -v
# Check code style (if linting is configured)
lint:
@echo "Note: Linting not configured. Add flake8/black/isort as needed."
# Run type checking with mypy
typecheck:
@echo "Running mypy type checker..."
python -m mypy PyMaSC --show-error-codes --pretty