-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
89 lines (74 loc) · 2.24 KB
/
Makefile
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
.PHONY: setup
setup: ## [py] Setup python environment
uv sync --all-extras
.PHONY: build
build: ## [py] Build python package
@echo "🧳 Building python package"
@[ -d dist ] && rm -r dist || true
uv build
.PHONY: check
check: check-tests check-format check-types ## [py] Run python checks
.PHONY: check-tests
check-tests: ## [py] Run python tests
@echo ""
@echo "🧪 Running tests with pytest"
uv run pytest
.PHONY: check-types
check-types: ## [py] Run python type checks
@echo ""
@echo "📝 Checking types with pyright"
uv run pyright
.PHONY: check-format
check-format:
@echo ""
@echo "📐 Checking format with ruff"
uv run ruff check chatlas --config pyproject.toml
.PHONY: format
format: ## [py] Format python code
uv run ruff check --fix chatlas --config pyproject.toml
uv run ruff format chatlas --config pyproject.toml
.PHONY: check-tox
check-tox: ## [py] Run python 3.9 - 3.12 checks with tox
@echo ""
@echo "🔄 Running tests and type checking with tox for Python 3.9--3.12"
uv run tox run-parallel
.PHONY: docs
docs: quartodoc
quarto render docs
.PHONY: docs-preview
docs-preview: quartodoc
quarto preview docs
.PHONY: quartodoc
quartodoc:
@echo "📖 Generating python docs with quartodoc"
@$(eval export IN_QUARTODOC=true)
cd docs && uv run quartodoc build
cd docs && uv run quartodoc interlinks
.PHONY: quartodoc-watch
quartodoc-watch:
@echo "📖 Generating python docs with quartodoc"
@$(eval export IN_QUARTODOC=true)
uv run quartodoc build --config docs/_quarto.yml --watch
.PHONY: update-snaps
update-snaps:
@echo "📸 Updating pytest snapshots"
uv run pytest --snapshot-update
.PHONY: update-types
update-types:
@echo "📝 Updating chat provider types"
uv run python scripts/main.py
.PHONY: help
help: ## Show help messages for make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; { \
printf "\033[32m%-18s\033[0m", $$1; \
if ($$2 ~ /^\[docs\]/) { \
printf "\033[34m[docs]\033[0m%s\n", substr($$2, 7); \
} else if ($$2 ~ /^\[py\]/) { \
printf " \033[33m[py]\033[0m%s\n", substr($$2, 5); \
} else if ($$2 ~ /^\[r\]/) { \
printf " \033[31m[r]\033[0m%s\n", substr($$2, 4); \
} else { \
printf " %s\n", $$2; \
} \
}'
.DEFAULT_GOAL := help