-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (40 loc) · 1.54 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
# Declare phony targets
.PHONY: install typecheck test build format clean docs view-docs help
# Install project in development mode
install: ## Install project in development mode
@echo "Installing project in development mode..."
@poetry install
# Run type checks on source code
type: ## Run type checks on source code
@echo "Running type checks..."
@poetry run mypy src/ test/
# Run unit tests
test: ## Run unit tests
@echo "Running unit tests..."
@poetry run pytest test/
# Build project
build: ## Build project
@echo "Building project..."
@poetry build
# Generate documentation
docs: ## Generate documentation
@echo "Generating documentation..."
@cd docs && poetry run make html
# Open documentation in a web browser
view-docs: ## Open documentation in a web browser
@echo "Opening documentation..."
@open docs/build/html/index.html
# Formats code in src/ and test/ using black
format: ## Format code with black
@echo "Formatting code..."
@poetry run black src/ test/
# Clean project
clean: ## Clean project
@echo "Cleaning project..."
@rm -rf venv .venv .mypy_cache .pytest_cache dist dist requirements.txt docs/build
@find . -name '*.egg-info' -type d -prune -exec rm -rf {} +
@find . -name '__pycache__' -type d -prune -exec rm -rf {} +
# Display help information
help: ## Display help information
@echo "Targets:"
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)