-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (89 loc) · 2.48 KB
/
Makefile
File metadata and controls
107 lines (89 loc) · 2.48 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
PY?=python3
PIP?=$(PY) -m pip
UVICORN?=uvicorn
APP=app.main:app
PORT?=8000
HOST?=0.0.0.0
ENV_FILE?=config/.env.example
# Docker configurations
DOCKERFILE?=deployments/docker/Dockerfile
DOCKER_IMAGE?=yolo-toys:latest
.PHONY: help
help:
@echo "Development Commands:"
@echo " install Install production dependencies"
@echo " dev Install runtime + dev dependencies and setup hooks"
@echo " run Run development server with auto-reload"
@echo " test Run test suite"
@echo " lint Run non-mutating lint and format checks"
@echo " typecheck Run BasedPyright type checking"
@echo " hooks Run all pre-commit hooks"
@echo " format Auto-format code"
@echo ""
@echo "Docker Commands:"
@echo " docker-build Build Docker image"
@echo " docker-build-cuda Build CUDA (GPU) Docker image"
@echo " docker-run Run Docker container"
@echo " compose-up Start with docker-compose"
@echo " compose-down Stop docker-compose"
@echo " compose-monitor Start with monitoring stack"
@echo ""
@echo "Utility Commands:"
@echo " clean Clean cache and temporary files"
@echo " setup Setup development environment"
.PHONY: install
install:
$(PIP) install -U pip
$(PIP) install -r requirements.txt
.PHONY: dev
dev: install
$(PIP) install -r requirements-dev.txt
pre-commit install
.PHONY: lint
lint:
ruff check .
ruff format --check .
.PHONY: hooks
hooks:
pre-commit run --all-files
.PHONY: typecheck
typecheck:
basedpyright
.PHONY: format
format:
ruff check --fix .
ruff format .
.PHONY: test
test:
SKIP_WARMUP=1 $(PY) -m pytest
.PHONY: run
run:
$(UVICORN) $(APP) --host $(HOST) --port $(PORT) --reload
# Docker commands
.PHONY: docker-build
docker-build:
docker build -f $(DOCKERFILE) -t $(DOCKER_IMAGE) .
.PHONY: docker-build-cuda
docker-build-cuda:
docker build -f deployments/docker/Dockerfile.cuda -t yolo-toys:cuda .
.PHONY: docker-run
docker-run:
docker run --rm -it -p $(PORT):$(PORT) --env-file $(ENV_FILE) $(DOCKER_IMAGE)
.PHONY: compose-up
compose-up:
docker compose up --build -d
.PHONY: compose-down
compose-down:
docker compose down --remove-orphans
.PHONY: compose-monitor
compose-monitor:
docker compose --profile monitoring up --build -d
# Utility commands
.PHONY: clean
clean:
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
rm -rf .ruff_cache .pytest_cache htmlcov .coverage
.PHONY: setup
setup:
$(MAKE) dev