-
Notifications
You must be signed in to change notification settings - Fork 201
/
Makefile
51 lines (44 loc) · 1.27 KB
/
Makefile
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
# Define variables for common directories and commands
PYTHON = poetry run
SRC_DIR = .
# Default target: Show help
.PHONY: help
help:
@echo "Available targets:"
@echo " setup Install dependencies and set up pre-commit hooks"
@echo " format Run Black and Ruff to format the code"
@echo " lint Run Ruff to check code quality"
@echo " test Run tests with pytest"
@echo " precommit Run pre-commit hooks on all files"
@echo " clean Clean up temporary files and build artifacts"
# Install dependencies and set up pre-commit hooks
.PHONY: setup
setup:
poetry install
poetry run pre-commit install
# Format code using Black and Ruff
.PHONY: format
format:
$(PYTHON) black $(SRC_DIR)
git ls-files | xargs pre-commit run black --files
# Run lint checks using Ruff
.PHONY: lint
lint:
$(PYTHON) ruff check $(SRC_DIR)
# Run all pre-commit hooks on all files
.PHONY: precommit
precommit:
$(PYTHON) pre-commit run --all-files
# Run tests
.PHONY: test
test:
$(PYTHON) pytest
# Clean up temporary files and build artifacts
.PHONY: clean
clean:
rm -rf .pytest_cache
rm -rf .mypy_cache
rm -rf __pycache__
rm -rf build dist *.egg-info
find . -type d -name "__pycache__" -exec rm -r {} +
find . -type f -name "*.pyc" -delete