-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
94 lines (79 loc) · 2.73 KB
/
makefile
File metadata and controls
94 lines (79 loc) · 2.73 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
# Makefile for the Lex LLM project
.PHONY: install run static-type-check lint lint-check test pr help clean-api generate-api install-dev run-dev generate-openapi-schema
# Default target
default: help
install:
@echo "--- 🚀 Installing project ---"
make generate-api
uv venv --clear
uv pip install -e build/lex_db_api # Installs lex_db_api as a package
uv sync
install-dev:
@echo "--- 🚀 Installing development dependencies ---"
make generate-api
uv venv --clear
uv pip install -e build/lex_db_api # Installs lex_db_api as a package
uv sync --dev
generate-api:
@echo "--- 🔧 Generating API client (docker) ---"
@mkdir -p build
docker run --rm \
--user $(shell id -u):$(shell id -g) \
-v ${PWD}:/local \
openapitools/openapi-generator-cli generate \
-i /local/openapi/lex-db.yaml \
-g python \
-o /local/build/lex_db_api \
--additional-properties=packageName=lex_db_api,pyproject=true
@echo "--- 🛠 Fixing pyproject.toml license with Python ---"
python3 fix_pyproject_license.py
clean-api:
@echo "--- 🧹 Cleaning generated client ---"
rm -rf build/
static-type-check:
@echo "--- 🔍 Running static type check ---"
uv run mypy src
lint:
@echo "--- 🧹 Running linters ---"
uv run ruff format . # running ruff formatting
uv run ruff check . --fix # running ruff linting
lint-check:
@echo "--- 🧹 Check is project is linted ---"
uv run ruff format . --check # running ruff formatting
uv run ruff check . # running ruff linting
test:
@echo "--- 🧪 Running tests ---"
uv run pytest src/tests/
pr:
@echo "--- 🚀 Running PR checks ---"
make install
make lint
make static-type-check
make test
make generate-openapi-schema
@echo "--- ✅ All checks passed ---"
@echo "--- 🚀 Ready to make a PR ---"
run:
@echo "--- ▶️ Running the application ---"
make generate-openapi-schema
uv run main.py
run-dev: install-dev
@echo "--- ▶️ Running the application in dev mode (hot reload) ---"
make generate-openapi-schema
uvicorn main:app --reload --host 0.0.0.0 --port 10000
generate-openapi-schema:
@echo "--- 📜 Generating OpenAPI schema ---"
uv run generate_openapi.py main:app --out openapi/openapi.yaml
@echo "OpenAPI schema generated successfully."
help:
@echo "Makefile for the Lex LLM project"
@echo ""
@echo "Available commands:"
@echo " install Install project dependencies"
@echo " run Run the application"
@echo " static-type-check Run static type checks"
@echo " lint Run linters"
@echo " lint-check Check if the project is linted"
@echo " test Run tests"
@echo " pr Run all checks for a pull request"
@echo " help Show this help message"