Skip to content

Commit ade46fb

Browse files
author
Trevor
authored
chore: add verbose option (V=1) to make targets (#1556)
Like the Linux kernel and a few other make based projects, adds `V=1` option to easily make `make` more verbose, revealing commands being executed, for example: make test V=1 Also: - Used `$(MAKE)` instead of `make` for recursive calls. - Added docs for updating setuptools to work on Python 3.11 on Ubuntu 24.04.
1 parent b4de97e commit ade46fb

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

DEVELOPMENT.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This document provides guidelines for developing and contributing to the ragas p
2121

2222
4. **Install Dependencies**
2323
```
24+
pip install -U setuptools # Required on newer Python versions (e.g., 3.11)
2425
pip install -e ".[dev]"
2526
```
2627

@@ -57,6 +58,11 @@ You can run the following command to check for code style issues:
5758
make run-ci
5859
```
5960

61+
Adding a `V=1` option makes the output more verbose, showing normally hidden commands, like so:
62+
```bash
63+
make run-ci V=1
64+
```
65+
6066
## Running Tests
6167

6268
To run the test suite:

Makefile

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,59 @@
11
GIT_ROOT ?= $(shell git rev-parse --show-toplevel)
22

3+
# Optionally show commands being executed with V=1
4+
Q := $(if $(V),,@)
5+
36
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}'
58

69
.PHONY: format lint type style clean run-benchmarks
710
format: ## Running code formatter: black and isort
811
@echo "(isort) Ordering imports..."
9-
@isort .
12+
$(Q)isort .
1013
@echo "(black) Formatting codebase..."
11-
@black --config pyproject.toml src tests docs
14+
$(Q)black --config pyproject.toml src tests docs
1215
@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 {} \;
1417
@echo "(ruff) Running fix only..."
15-
@ruff check src docs tests --fix-only
18+
$(Q)ruff check src docs tests --fix-only
1619
lint: ## Running lint checker: ruff
1720
@echo "(ruff) Linting development project..."
18-
@ruff check src docs tests
21+
$(Q)ruff check src docs tests
1922
type: ## Running type checker: pyright
2023
@echo "(pyright) Typechecking codebase..."
2124
PYRIGHT_PYTHON_FORCE_VERSION=latest pyright src/ragas
2225
clean: ## Clean all generated files
2326
@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
2730
test: ## Run tests
2831
@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)
3033
test-e2e: ## Run end2end tests
3134
echo "running end2end tests..."
32-
@pytest --nbmake tests/e2e -s
35+
$(Q)pytest --nbmake tests/e2e -s
3336
run-ci: format lint type test ## Running all CI checks
3437

3538
# Docs
3639
rewrite-docs: ## Use GPT4 to rewrite the documentation
3740
@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)
3942
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
4144
docsite: ## Build and serve documentation
42-
@$(MAKE) ipynb-to-md
43-
@mkdocs serve
45+
$(Q)$(MAKE) ipynb-to-md
46+
$(Q)mkdocs serve
4447

4548
# Benchmarks
4649
run-benchmarks-eval: ## Run benchmarks for Evaluation
4750
@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
4952
run-benchmarks-testset: ## Run benchmarks for TestSet Generation
5053
@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
5255
run-benchmarks-in-docker: ## Run benchmarks in docker
5356
@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 .
5659
docker inspect ragas-benchmark:latest | jq ".[0].Size" | numfmt --to=si

0 commit comments

Comments
 (0)