forked from redis/redis-vl-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (81 loc) · 3.81 KB
/
Makefile
File metadata and controls
102 lines (81 loc) · 3.81 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
.PHONY: install format lint test test-all test-notebooks clean redis-start redis-stop check-types docs-build docs-serve check help
.DEFAULT_GOAL := help
# Allow passing arguments to make targets (e.g., make test ARGS="--run-api-tests")
ARGS ?=
install: ## Install the project and all dependencies
@echo "🚀 Installing project dependencies with uv"
uv sync --all-extras
redis-start: ## Start Redis in Docker
@echo "🐳 Starting Redis"
docker run -d --name redis -p 6379:6379 redis:latest
@sleep 1
@docker exec redis redis-cli INFO server | grep redis_version
redis-stop: ## Stop Redis Docker container
@echo "🛑 Stopping Redis"
docker stop redis || true
docker rm redis || true
format: ## Format code with isort and black
@echo "🎨 Formatting code"
uv run isort ./redisvl ./tests/ --profile black
uv run black ./redisvl ./tests/
check-format: ## Check code formatting
@echo "🔍 Checking code formatting"
uv run black --check ./redisvl
sort-imports: ## Sort imports with isort
@echo "📦 Sorting imports"
uv run isort ./redisvl ./tests/ --profile black
check-sort-imports: ## Check import sorting
@echo "🔍 Checking import sorting"
uv run isort ./redisvl --check-only --profile black
check-lint: ## Run pylint
@echo "🔍 Running pylint"
uv run pylint --rcfile=.pylintrc ./redisvl
check-types: ## Run mypy type checking
@echo "🔍 Running mypy type checking"
uv run python -m mypy ./redisvl
lint: format check-types ## Run all linting (format + type check)
test: ## Run tests (pass extra args with ARGS="...")
@echo "🧪 Running tests"
uv run python -m pytest -n auto --log-level=CRITICAL $(ARGS)
test-verbose: ## Run tests with verbose output
@echo "🧪 Running tests (verbose)"
uv run python -m pytest -n auto -vv -s --log-level=CRITICAL $(ARGS)
test-all: ## Run all tests including API tests
@echo "🧪 Running all tests including API tests"
uv run python -m pytest -n auto --log-level=CRITICAL --run-api-tests $(ARGS)
test-notebooks: ## Run notebook tests
@echo "📓 Running notebook tests"
@echo "🔍 Checking Redis version..."
@if uv run python -c "import redis; from redisvl.redis.connection import supports_svs; client = redis.Redis.from_url('redis://localhost:6379'); exit(0 if supports_svs(client) else 1)" 2>/dev/null; then \
echo "✅ Redis 8.2.0+ detected - running all notebooks"; \
uv run python -m pytest --nbval-lax ./docs/user_guide -vvv $(ARGS); \
else \
echo "⚠️ Redis < 8.2.0 detected - skipping SVS notebook"; \
uv run python -m pytest --nbval-lax ./docs/user_guide -vvv --ignore=./docs/user_guide/09_svs_vamana.ipynb $(ARGS); \
fi
check: lint test ## Run all checks (lint + test)
docs-build: ## Build documentation
@echo "📚 Building documentation"
uv run make -C docs html
docs-serve: ## Serve documentation locally
@echo "🌐 Serving documentation at http://localhost:8000"
@echo "📁 Make sure docs are built first with 'make docs-build'"
uv run python -m http.server --directory docs/_build/html
build: ## Build wheel and source distribution
@echo "🏗️ Building distribution packages"
uv build
clean: ## Clean up build artifacts and caches
@echo "🧹 Cleaning up directory"
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name ".coverage" -delete
find . -type d -name "htmlcov" -exec rm -rf {} +
find . -type d -name "dist" -exec rm -rf {} +
find . -type d -name "build" -exec rm -rf {} +
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type d -name "_build" -exec rm -rf {} +
find . -type f -name "*.log" -exec rm -rf {} +
help: ## Show this help message
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'