-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (64 loc) · 1.97 KB
/
Makefile
File metadata and controls
78 lines (64 loc) · 1.97 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
# Library Management System - Makefile
# Common commands for development and deployment
.PHONY: help install install-dev test test-cov lint format run-cli run-api docker-build docker-run docker-stop clean
# Default target
help:
@echo "Library Management System - Available Commands"
@echo ""
@echo "Setup:"
@echo " make install Install production dependencies"
@echo " make install-dev Install development dependencies"
@echo ""
@echo "Development:"
@echo " make test Run tests"
@echo " make test-cov Run tests with coverage report"
@echo " make lint Run linter (ruff)"
@echo " make format Format code (ruff)"
@echo ""
@echo "Running:"
@echo " make run-cli Start the CLI application"
@echo " make run-api Start the API server"
@echo ""
@echo "Docker:"
@echo " make docker-build Build Docker image"
@echo " make docker-run Run Docker container"
@echo " make docker-stop Stop Docker container"
@echo ""
@echo "Cleanup:"
@echo " make clean Remove generated files"
# Setup targets
install:
pip install -r requirements.txt
install-dev:
pip install -r requirements.txt
pip install ruff
# Development targets
test:
pytest -v
test-cov:
pytest --cov=. --cov-report=html --cov-report=term-missing
@echo "Coverage report generated in htmlcov/index.html"
lint:
ruff check .
format:
ruff format .
ruff check --fix .
# Running targets
run-cli:
python main.py
run-api:
uvicorn api:app --reload --host 127.0.0.1 --port 8000
# Docker targets
docker-build:
docker build -t library-management:latest .
docker-run:
docker-compose up -d
@echo "Container started. API available at http://localhost:8000"
@echo "Use 'make docker-stop' to stop the container"
docker-stop:
docker-compose down
# Cleanup targets
clean:
rm -rf __pycache__ .pytest_cache htmlcov .coverage *.egg-info dist build
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true