-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (54 loc) · 1.91 KB
/
Makefile
File metadata and controls
69 lines (54 loc) · 1.91 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
# Define the directory containing the source code
SRC_DIR := ./src
TEST_DIR := ./tests
EXAMPLE_DIR := ./examples
# Optional install extras via `make install <extra>` or `make build <extra>`
ifneq (,$(filter install build,$(MAKECMDGOALS)))
EXTRAS := $(filter-out install build,$(MAKECMDGOALS))
comma := ,
empty :=
space := $(empty) $(empty)
EXTRA_LIST := $(subst $(space),$(comma),$(strip $(EXTRAS)))
endif
.PHONY: all
all: test lint build
##@ General
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Development
.PHONY: install
install: ## Install project dependencies. Example: `make install openai`
ifneq ($(strip $(EXTRA_LIST)),)
uv pip install --editable ".[${EXTRA_LIST}]"
else
uv pip install --editable .
endif
ifneq ($(strip $(EXTRAS)),)
.PHONY: $(EXTRAS)
$(EXTRAS):
@:
endif
.PHONY: dev
dev: ## Install development dependencies.
uv pip install ".[dev]"
.PHONY: test
test: ## Run tests.
uv run --no-project --no-reinstall pytest $(TEST_DIR) --cov --cov-config=.coveragerc -vv -s
.PHONY: clean
clean: ## Remove build artifacts.
rm -rf build dist *.egg-info .pytest_cache .coverage
.PHONY: format
format: ## Format code using ruff.
uv run --no-project --no-reinstall isort $(SRC_DIR) $(TEST_DIR) $(EXAMPLE_DIR)
uv run --no-project --no-reinstall ruff format $(SRC_DIR) $(TEST_DIR) $(EXAMPLE_DIR); uv run --no-project --no-reinstall ruff check --fix $(SRC_DIR) $(TEST_DIR) $(EXAMPLE_DIR)
.PHONY: lint
lint: ## Run linters using ruff.
uv run --no-project --no-reinstall ruff format --diff $(SRC_DIR) $(TEST_DIR)
uv run --no-project --no-reinstall mypy $(SRC_DIR) $(TEST_DIR)
.PHONY: check
check: format lint ## Run format and lint.
##@ Build
.PHONY: build
build: ## Build the application.
uv build