-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (62 loc) · 1.72 KB
/
Makefile
File metadata and controls
72 lines (62 loc) · 1.72 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
# Makefile for ExpertBench/omb
# Variables
PYTHON := python
PIP := pip
PYTEST := pytest
BLACK := black
ISORT := isort
FLAKE8 := flake8
MYPY := mypy
PYLINT := pylint
SRC_DIR := src
TEST_DIR := tests
.PHONY: help install test lint format clean check format-check
# Default target
help:
@echo "Available commands:"
@echo " make install - Install development dependencies"
@echo " make test - Run tests using pytest"
@echo " make lint - Run static analysis (flake8, mypy, pylint)"
@echo " make format - Format code using black and isort"
@echo " make format-check - Check code formatting without modifying files"
@echo " make clean - Remove build artifacts and cache directories"
@echo " make check - Run all checks (format-check, lint, test)"
install:
$(PIP) install -e ".[dev]"
test:
@if [ -d "$(TEST_DIR)" ]; then \
$(PYTEST); \
else \
echo "Warning: '$(TEST_DIR)' directory not found. Skipping tests."; \
fi
lint:
@echo "Running flake8..."
-$(FLAKE8) $(SRC_DIR)
@echo "Running mypy..."
-$(MYPY) $(SRC_DIR)
@echo "Running pylint..."
-$(PYLINT) $(SRC_DIR)
format:
@echo "Formatting with isort..."
$(ISORT) $(SRC_DIR)
@echo "Formatting with black..."
$(BLACK) $(SRC_DIR)
format-check:
@echo "Checking import sort order..."
$(ISORT) --check-only --diff $(SRC_DIR)
@echo "Checking code formatting..."
$(BLACK) --check --diff $(SRC_DIR)
clean:
rm -rf __pycache__
rm -rf $(SRC_DIR)/__pycache__
rm -rf $(SRC_DIR)/*/__pycache__
rm -rf $(TEST_DIR)/__pycache__
rm -rf .pytest_cache
rm -rf .mypy_cache
rm -rf .ruff_cache
rm -rf build
rm -rf dist
rm -rf *.egg-info
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
check: format-check lint test