-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathMakefile
More file actions
121 lines (99 loc) Β· 4.09 KB
/
Makefile
File metadata and controls
121 lines (99 loc) Β· 4.09 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
.PHONY: install
install: ## Install the virtual environment and install the pre-commit hooks
@echo "π Creating virtual environment using uv"
@uv sync
@uv run pre-commit install
.PHONY: check
check: ## Run code quality tools.
@echo "π Checking lock file consistency with 'pyproject.toml'"
@uv lock --locked
@echo "π Linting code: Running pre-commit"
@uv run pre-commit run -a
@echo "π Static type checking: Running ty"
@uv run ty check
@echo "π Checking for obsolete dependencies: Running deptry"
@uv run deptry .
.PHONY: test docker-up docker-down docker-wait clean-docker
# PostgreSQL 컨ν
μ΄λ μμ
docker-up:
@echo "π Starting PostgreSQL containers..."
@mkdir -p postgresql/pgdata
@cd postgresql && docker compose --env-file .env up -d
# PostgreSQL μ€λΉ λκΈ°
docker-wait:
@echo "β³ Waiting for PostgreSQL to be ready..."
@until docker compose -f postgresql/docker-compose.yml --env-file postgresql/.env exec -T db pg_isready -U postgres > /dev/null 2>&1; do \
sleep 1; \
done
@echo "β
PostgreSQL is ready!"
# PostgreSQL 컨ν
μ΄λ μ€μ§ λ° μμ
docker-down:
@echo "π Stopping PostgreSQL containers..."
@cd postgresql && docker compose --env-file .env down
# μμ μ 리 (λ³Όλ₯¨ ν¬ν¨)
clean-docker:
@echo "π§Ή Cleaning up PostgreSQL containers and volumes..."
@cd postgresql && docker compose --env-file .env down -v
@echo "ποΈ Removing pgdata directory..."
@rm -rf postgresql/pgdata
# Run test (except gpu and data tests)
test: docker-up docker-wait ## Test the code with pytest
@echo "π Testing code: Running pytest"
@uv run python -m pytest -m "not gpu and not data"; \
TEST_EXIT_CODE=$$?; \
$(MAKE) clean-docker; \
exit $$TEST_EXIT_CODE
# Run test only data (except gpu)
test-data: docker-up docker-wait ## Test the code with pytest
@echo "π Testing code: Running pytest"
@uv run python -m pytest -m "data"; \
TEST_EXIT_CODE=$$?; \
$(MAKE) clean-docker; \
exit $$TEST_EXIT_CODE
# Run full tests
test-full: docker-up docker-wait ## Test the code with pytest
@echo "π Testing code: Running pytest"
@uv run python -m pytest; \
TEST_EXIT_CODE=$$?; \
$(MAKE) clean-docker; \
exit $$TEST_EXIT_CODE
# ν
μ€νΈλ§ μ€ν (컨ν
μ΄λλ μ μ§)
test-only: ## Run tests without managing Docker containers
@echo "π Testing code: Running pytest"
@uv run python -m pytest -m "not gpu and not data"
.PHONY: build
build: clean-build ## Build wheel file
@echo "π Creating wheel file"
@uvx --from build pyproject-build --installer uv
.PHONY: clean-build
clean-build: ## Clean build artifacts
@echo "π Removing build artifacts"
@uv run python -c "import shutil; import os; shutil.rmtree('dist') if os.path.exists('dist') else None"
.PHONY: publish
publish: ## Publish a release to PyPI.
@echo "π Publishing."
@uvx twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
.PHONY: build-and-publish
build-and-publish: build publish ## Build and publish.
.PHONY: docs-test
docs-test: ## Test if documentation can be built without warnings or errors
@uv run mkdocs build -s
.PHONY: docs
docs: ## Build and serve the documentation
@uv run mkdocs serve
.PHONY: help
help:
@uv run python -c "import re; \
[[print(f'\033[36m{m[0]:<20}\033[0m {m[1]}') for m in re.findall(r'^([a-zA-Z_-]+):.*?## (.*)$$', open(makefile).read(), re.M)] for makefile in ('$(MAKEFILE_LIST)').strip().split()]"
# UI Development targets
.PHONY: ui-setup ui-launch ui-restart
ui-setup: ## Setup UI development databases (dataset_alpha, dataset_beta, dataset_gamma)
@echo "π¨ Setting up UI development databases..."
@set -a && . postgresql/.env && set +a && uv run python scripts/setup_ui_dev_databases.py
ui-launch: docker-up docker-wait ui-setup ## Launch UI with full setup (Docker + databases + UI)
@echo "π Launching AutoRAG Leaderboard UI..."
@set -a && . postgresql/.env && set +a && uv run python -m autorag_research.reporting.ui
ui-restart: ## Restart UI only (assumes databases already exist)
@echo "π Restarting AutoRAG Leaderboard UI..."
@set -a && . postgresql/.env && set +a && uv run python -m autorag_research.reporting.ui
.DEFAULT_GOAL := help