|
1 | 1 | GIT_ROOT ?= $(shell git rev-parse --show-toplevel) |
2 | 2 |
|
| 3 | +# Optionally show commands being executed with V=1 |
| 4 | +Q := $(if $(V),,@) |
| 5 | + |
3 | 6 | help: ## Show all Makefile targets |
4 | | - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' |
| 7 | + $(Q)grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' |
5 | 8 |
|
6 | 9 | .PHONY: format lint type style clean run-benchmarks |
7 | 10 | format: ## Running code formatter: black and isort |
8 | 11 | @echo "(isort) Ordering imports..." |
9 | | - @isort . |
| 12 | + $(Q)isort . |
10 | 13 | @echo "(black) Formatting codebase..." |
11 | | - @black --config pyproject.toml src tests docs |
| 14 | + $(Q)black --config pyproject.toml src tests docs |
12 | 15 | @echo "(black) Formatting stubs..." |
13 | | - @find src -name "*.pyi" ! -name "*_pb2*" -exec black --pyi --config pyproject.toml {} \; |
| 16 | + $(Q)find src -name "*.pyi" ! -name "*_pb2*" -exec black --pyi --config pyproject.toml {} \; |
14 | 17 | @echo "(ruff) Running fix only..." |
15 | | - @ruff check src docs tests --fix-only |
| 18 | + $(Q)ruff check src docs tests --fix-only |
16 | 19 | lint: ## Running lint checker: ruff |
17 | 20 | @echo "(ruff) Linting development project..." |
18 | | - @ruff check src docs tests |
| 21 | + $(Q)ruff check src docs tests |
19 | 22 | type: ## Running type checker: pyright |
20 | 23 | @echo "(pyright) Typechecking codebase..." |
21 | 24 | PYRIGHT_PYTHON_FORCE_VERSION=latest pyright src/ragas |
22 | 25 | clean: ## Clean all generated files |
23 | 26 | @echo "Cleaning all generated files..." |
24 | | - @cd $(GIT_ROOT)/docs && make clean |
25 | | - @cd $(GIT_ROOT) || exit 1 |
26 | | - @find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete |
| 27 | + $(Q)cd $(GIT_ROOT)/docs && $(MAKE) clean |
| 28 | + $(Q)cd $(GIT_ROOT) || exit 1 |
| 29 | + $(Q)find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete |
27 | 30 | test: ## Run tests |
28 | 31 | @echo "Running tests..." |
29 | | - @pytest --nbmake tests/unit $(shell if [ -n "$(k)" ]; then echo "-k $(k)"; fi) |
| 32 | + $(Q)pytest --nbmake tests/unit $(shell if [ -n "$(k)" ]; then echo "-k $(k)"; fi) |
30 | 33 | test-e2e: ## Run end2end tests |
31 | 34 | echo "running end2end tests..." |
32 | | - @pytest --nbmake tests/e2e -s |
| 35 | + $(Q)pytest --nbmake tests/e2e -s |
33 | 36 | run-ci: format lint type test ## Running all CI checks |
34 | 37 |
|
35 | 38 | # Docs |
36 | 39 | rewrite-docs: ## Use GPT4 to rewrite the documentation |
37 | 40 | @echo "Rewriting the documentation in directory $(DIR)..." |
38 | | - @python $(GIT_ROOT)/docs/python alphred.py --directory $(DIR) |
| 41 | + $(Q)python $(GIT_ROOT)/docs/python alphred.py --directory $(DIR) |
39 | 42 | ipynb-to-md: ## Convert ipynb files to md files |
40 | | - @python $(GIT_ROOT)/scripts/ipynb_to_md.py |
| 43 | + $(Q)python $(GIT_ROOT)/scripts/ipynb_to_md.py |
41 | 44 | docsite: ## Build and serve documentation |
42 | | - @$(MAKE) ipynb-to-md |
43 | | - @mkdocs serve |
| 45 | + $(Q)$(MAKE) ipynb-to-md |
| 46 | + $(Q)mkdocs serve |
44 | 47 |
|
45 | 48 | # Benchmarks |
46 | 49 | run-benchmarks-eval: ## Run benchmarks for Evaluation |
47 | 50 | @echo "Running benchmarks for Evaluation..." |
48 | | - @cd $(GIT_ROOT)/tests/benchmarks && python benchmark_eval.py |
| 51 | + $(Q)cd $(GIT_ROOT)/tests/benchmarks && python benchmark_eval.py |
49 | 52 | run-benchmarks-testset: ## Run benchmarks for TestSet Generation |
50 | 53 | @echo "Running benchmarks for TestSet Generation..." |
51 | | - @cd $(GIT_ROOT)/tests/benchmarks && python benchmark_testsetgen.py |
| 54 | + $(Q)cd $(GIT_ROOT)/tests/benchmarks && python benchmark_testsetgen.py |
52 | 55 | run-benchmarks-in-docker: ## Run benchmarks in docker |
53 | 56 | @echo "Running benchmarks in docker..." |
54 | | - @cd $(GIT_ROOT) |
55 | | - docker buildx build --build-arg OPENAI_API_KEY=$(OPENAI_API_KEY) -t ragas-benchmark -f $(GIT_ROOT)/tests/benchmarks/Dockerfile . |
| 57 | + $(Q)cd $(GIT_ROOT) |
| 58 | + docker buildx build --build-arg OPENAI_API_KEY=$(OPENAI_API_KEY) -t ragas-benchmark -f $(GIT_ROOT)/tests/benchmarks/Dockerfile . |
56 | 59 | docker inspect ragas-benchmark:latest | jq ".[0].Size" | numfmt --to=si |
0 commit comments