-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
201 lines (157 loc) · 6.08 KB
/
Makefile
File metadata and controls
201 lines (157 loc) · 6.08 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# =============================================================================
# Surfaces Makefile
# =============================================================================
.PHONY: build install uninstall test lint format check clean help
# =============================================================================
# Installation
# =============================================================================
install-editable:
pip install -e .
install-dev:
pip install -e ".[dev]"
install-test:
pip install -e ".[test]"
install-test-minimal:
pip install -e ".[test-minimal]"
install-build:
pip install build
reinstall-editable:
pip uninstall -y surfaces || true
pip install -e .
# =============================================================================
# Building
# =============================================================================
build:
python -m build
install: build
pip install dist/*.whl
uninstall:
pip uninstall -y surfaces || true
rm -fr build dist *.egg-info
reinstall: uninstall install
# =============================================================================
# Testing
# =============================================================================
py-test:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -x -p no:warnings tests/
test-examples:
cd tests && python _test_examples.py
test: py-test test-examples
# Test with minimal dependencies (no sklearn, no viz, no GFO)
test-minimal:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -x -p no:warnings \
tests/test_1d_functions.py \
tests/test_2d_functions.py \
tests/test_nd_functions.py \
tests/test_all_test_functions.py \
tests/test_api/test_input_type.py \
tests/test_api/test_metric.py \
tests/test_api/test_sleep.py
# Integration tests with optimization libraries (requires GFO, optuna, scipy)
test-integrations:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -x -p no:warnings \
tests/test_optimization.py \
tests/test_api/test_search_space.py
# Test with coverage
test-cov:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest --cov=surfaces --cov-report=term-missing --cov-report=xml -p no:warnings tests/
# =============================================================================
# Code Quality
# =============================================================================
lint:
ruff check .
lint-fix:
ruff check --fix .
format:
ruff format .
format-check:
ruff format --check .
check: lint format-check
fix: lint-fix format
# =============================================================================
# Pre-commit
# =============================================================================
pre-commit-install:
pre-commit install
pre-commit-all:
pre-commit run --all-files
pre-commit-update:
pre-commit autoupdate
# =============================================================================
# Documentation
# =============================================================================
.PHONY: docs docs-generate docs-build docs-clean docs-serve docs-quick
# Generate documentation assets (catalogs, plots, diagrams)
docs-generate:
python -m docs._generators.generate_all
# Build HTML documentation with Sphinx
docs-build:
cd docs && sphinx-build -b html source build/html
# Full documentation build (generate + build)
docs: docs-generate docs-build
# Clean generated documentation
docs-clean:
rm -rf docs/source/_generated/*
rm -rf docs/build/*
# Serve documentation locally
docs-serve: docs
python -m http.server 8000 -d docs/build/html
# Quick rebuild (skip asset generation)
docs-quick:
cd docs && sphinx-build -b html source build/html
# Check for broken links
docs-linkcheck:
cd docs && sphinx-build -b linkcheck source build/linkcheck
# =============================================================================
# Cleanup
# =============================================================================
clean:
rm -fr build dist *.egg-info
rm -fr .pytest_cache .ruff_cache .coverage coverage.xml
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
# =============================================================================
# Help
# =============================================================================
help:
@echo "Surfaces Development Commands"
@echo "=============================="
@echo ""
@echo "Installation:"
@echo " install-editable Install package in editable mode"
@echo " install-dev Install with dev dependencies"
@echo " install-test Install with test dependencies (full)"
@echo " install-test-minimal Install with minimal test dependencies"
@echo ""
@echo "Testing:"
@echo " test Run all tests"
@echo " py-test Run pytest only"
@echo " test-minimal Run core tests (no optional deps)"
@echo " test-integrations Run integration tests (GFO, optuna, scipy)"
@echo " test-cov Run tests with coverage"
@echo ""
@echo "Code Quality:"
@echo " lint Check code with ruff"
@echo " lint-fix Fix linting issues"
@echo " format Format code with ruff"
@echo " format-check Check code formatting"
@echo " check Run all checks (lint + format)"
@echo " fix Fix all issues (lint + format)"
@echo ""
@echo "Pre-commit:"
@echo " pre-commit-install Install pre-commit hooks"
@echo " pre-commit-all Run pre-commit on all files"
@echo " pre-commit-update Update pre-commit hooks"
@echo ""
@echo "Documentation:"
@echo " docs Build full documentation (generate + build)"
@echo " docs-generate Generate documentation assets only"
@echo " docs-build Build HTML documentation only"
@echo " docs-clean Remove generated documentation"
@echo " docs-serve Build and serve documentation locally"
@echo " docs-quick Quick rebuild (skip generation)"
@echo " docs-linkcheck Check for broken links"
@echo ""
@echo "Other:"
@echo " build Build package"
@echo " clean Remove build artifacts"