Skip to content

Commit 2836c03

Browse files
committed
pre-commit all
1 parent 569884a commit 2836c03

File tree

104 files changed

+2038
-1955
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2038
-1955
lines changed

Makefile

Lines changed: 128 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,151 @@
1-
build:
2-
python -m build
1+
# =============================================================================
2+
# Surfaces Makefile
3+
# =============================================================================
34

4-
install: build
5-
pip install dist/*.whl
5+
.PHONY: build install uninstall test lint format check clean help
66

7-
uninstall:
8-
pip uninstall -y surfaces
9-
rm -fr build dist *.egg-info
7+
# =============================================================================
8+
# Installation
9+
# =============================================================================
10+
11+
install-editable:
12+
pip install -e .
1013

1114
install-dev:
1215
pip install -e ".[dev]"
1316

1417
install-test:
1518
pip install -e ".[test]"
1619

20+
install-test-minimal:
21+
pip install -e ".[test-minimal]"
22+
1723
install-build:
1824
pip install build
1925

20-
install-editable:
26+
reinstall-editable:
27+
pip uninstall -y surfaces || true
2128
pip install -e .
2229

30+
# =============================================================================
31+
# Building
32+
# =============================================================================
33+
34+
build:
35+
python -m build
36+
37+
install: build
38+
pip install dist/*.whl
39+
40+
uninstall:
41+
pip uninstall -y surfaces || true
42+
rm -fr build dist *.egg-info
43+
2344
reinstall: uninstall install
2445

25-
reinstall-editable: uninstall install-editable
46+
# =============================================================================
47+
# Testing
48+
# =============================================================================
49+
50+
py-test:
51+
python -m pytest -x -p no:warnings tests/
2652

2753
test-examples:
28-
cd tests; \
29-
python _test_examples.py
54+
cd tests && python _test_examples.py
3055

31-
py-test:
32-
python -m pytest -x -p no:warnings tests/; \
56+
test: py-test test-examples
57+
58+
# Test with minimal dependencies (no sklearn, no viz)
59+
test-minimal:
60+
python -m pytest -x -p no:warnings tests/test_1d_functions.py tests/test_2d_functions.py tests/test_nd_functions.py
61+
62+
# Test with coverage
63+
test-cov:
64+
python -m pytest --cov=surfaces --cov-report=term-missing --cov-report=xml -p no:warnings tests/
65+
66+
# =============================================================================
67+
# Code Quality
68+
# =============================================================================
69+
70+
lint:
71+
ruff check .
72+
73+
lint-fix:
74+
ruff check --fix .
75+
76+
format:
77+
ruff format .
78+
79+
format-check:
80+
ruff format --check .
81+
82+
check: lint format-check
3383

34-
test: py-test test-examples
84+
fix: lint-fix format
85+
86+
# =============================================================================
87+
# Pre-commit
88+
# =============================================================================
89+
90+
pre-commit-install:
91+
pre-commit install
92+
93+
pre-commit-all:
94+
pre-commit run --all-files
95+
96+
pre-commit-update:
97+
pre-commit autoupdate
98+
99+
# =============================================================================
100+
# Data Collection
101+
# =============================================================================
35102

36103
database:
37104
python -m collect_search_data.py
105+
106+
# =============================================================================
107+
# Cleanup
108+
# =============================================================================
109+
110+
clean:
111+
rm -fr build dist *.egg-info
112+
rm -fr .pytest_cache .ruff_cache .coverage coverage.xml
113+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
114+
find . -type f -name "*.pyc" -delete
115+
116+
# =============================================================================
117+
# Help
118+
# =============================================================================
119+
120+
help:
121+
@echo "Surfaces Development Commands"
122+
@echo "=============================="
123+
@echo ""
124+
@echo "Installation:"
125+
@echo " install-editable Install package in editable mode"
126+
@echo " install-dev Install with dev dependencies"
127+
@echo " install-test Install with test dependencies (full)"
128+
@echo " install-test-minimal Install with minimal test dependencies"
129+
@echo ""
130+
@echo "Testing:"
131+
@echo " test Run all tests"
132+
@echo " py-test Run pytest only"
133+
@echo " test-minimal Run tests for core functions (no optional deps)"
134+
@echo " test-cov Run tests with coverage"
135+
@echo ""
136+
@echo "Code Quality:"
137+
@echo " lint Check code with ruff"
138+
@echo " lint-fix Fix linting issues"
139+
@echo " format Format code with ruff"
140+
@echo " format-check Check code formatting"
141+
@echo " check Run all checks (lint + format)"
142+
@echo " fix Fix all issues (lint + format)"
143+
@echo ""
144+
@echo "Pre-commit:"
145+
@echo " pre-commit-install Install pre-commit hooks"
146+
@echo " pre-commit-all Run pre-commit on all files"
147+
@echo " pre-commit-update Update pre-commit hooks"
148+
@echo ""
149+
@echo "Other:"
150+
@echo " build Build package"
151+
@echo " clean Remove build artifacts"

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
### Use Cases
2626

2727
- **Algorithm Development**: Test new optimization algorithms against established benchmarks
28-
- **Performance Comparison**: Compare different optimizers on standardized problem sets
28+
- **Performance Comparison**: Compare different optimizers on standardized problem sets
2929
- **Research Publications**: Use well-known test functions with consistent implementations
3030
- **Educational Purposes**: Learn optimization concepts with visual and mathematical examples
3131
- **Hyperparameter Tuning**: Benchmark autoML and hyperparameter optimization methods
@@ -40,7 +40,7 @@
4040
<table style="width:100%">
4141
<tr>
4242
<th> <b>Objective Function</b> </th>
43-
<th> <b>Heatmap</b> </th>
43+
<th> <b>Heatmap</b> </th>
4444
<th> <b>Surface Plot</b> </th>
4545
</tr>
4646
<tr>
@@ -125,7 +125,7 @@ Import from `surfaces.test_functions.mathematical`:
125125
Import from `surfaces.test_functions.machine_learning`:
126126

127127
- `KNeighborsClassifierFunction` - K-nearest neighbors classification
128-
- `KNeighborsRegressorFunction` - K-nearest neighbors regression
128+
- `KNeighborsRegressorFunction` - K-nearest neighbors regression
129129
- `GradientBoostingRegressorFunction` - Gradient boosting regression
130130

131131
### Common Interface
@@ -175,7 +175,7 @@ print(search_space.keys()) # dict_keys(['n_neighbors', 'algorithm', 'cv', 'data
175175
# Evaluate function
176176
params = {
177177
'n_neighbors': 5,
178-
'algorithm': 'auto',
178+
'algorithm': 'auto',
179179
'cv': 3,
180180
'dataset': knn_func.search_space()['dataset'][0]
181181
}
@@ -190,12 +190,11 @@ from surfaces.test_functions.mathematical import SphereFunction
190190

191191
# Create functions with different dimensionalities
192192
sphere_1d = SphereFunction(n_dim=1)
193-
sphere_3d = SphereFunction(n_dim=3)
193+
sphere_3d = SphereFunction(n_dim=3)
194194
sphere_10d = SphereFunction(n_dim=10)
195195

196196
# Each has appropriate search space
197197
print(sphere_1d.search_space().keys()) # dict_keys(['x0'])
198198
print(sphere_3d.search_space().keys()) # dict_keys(['x0', 'x1', 'x2'])
199199
print(sphere_10d.search_space().keys()) # dict_keys(['x0', 'x1', ..., 'x9'])
200200
```
201-

0 commit comments

Comments
 (0)