-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (51 loc) · 1.57 KB
/
Makefile
File metadata and controls
62 lines (51 loc) · 1.57 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
.PHONY: analyze-dependencies lint format type-check run-unit-tests clean check-all init-db reset-db
PYTHON_PATH = PYTHONPATH=./app:./tests
TEST_ENV = ENV_FILE=.env.test $(PYTHON_PATH)
APP_PYTHON_PATH = PYTHONPATH=./app
COVERAGE_PATHS = --cov=app/api --cov=app/core --cov=app/repository --cov=app/service --cov=app/utility
# Analyze Dependencies
analyze-dependencies:
@echo "Analyzing dependencies..."
$(APP_PYTHON_PATH) pydeps ./app
# Run Server
run:
@echo "Running the server..."
$(APP_PYTHON_PATH) uv run uvicorn app.main:http_api_app --reload --port 7086 --host 0.0.0.0
# Run the unit tests
run-unit-tests:
@echo "Running unit tests..."
$(TEST_ENV) uv run pytest tests/unit $(COVERAGE_PATHS)
# Clean up build artifacts and cache
clean:
@echo "Cleaning up..."
find . -type d -name '__pycache__' -exec rm -r {} +
find . -type d -name '.ruff_cache' -exec rm -r {} +
find . -type d -name '.pytest_cache' -exec rm -r {} +
# Lint the code using Ruff
lint:
@echo "Linting the code..."
$(PYTHON_PATH) uv run ruff check .
# Format the code using Ruff
format:
@echo "Formatting the code..."
$(PYTHON_PATH) uv run ruff format .
# Type-check the code using Pyright
type-check:
@echo "Type-checking the code..."
$(PYTHON_PATH) uv run pyright
# Check all
check-all:
@echo "Checking all..."
make clean
make lint
make format
make type-check
make run-unit-tests
# Initialize database
init-db:
@echo "Initializing database..."
ENV_FILE=.env ./scripts/init_db_pg.sh init
# Reset database to initial state
reset-db:
@echo "Resetting database..."
ENV_FILE=.env ./scripts/init_db_pg.sh reset