-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (76 loc) · 2.44 KB
/
Makefile
File metadata and controls
100 lines (76 loc) · 2.44 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
# Code quality
.PHONY: code.format code.lint code.test code.cov code.cov.html code.check
code.format:
ruff format
code.lint: code.format
deptry
slotscheck src
lint-imports
ruff check --exit-non-zero-on-fix
mypy
code.test:
pytest -v
code.cov:
coverage run -m pytest
coverage combine
coverage report
code.cov.html:
coverage run -m pytest
coverage combine
coverage html
code.check: code.lint code.test
# Environment
PYTHON := python
CONFIGS_DIG := config
TOML_CONFIG_MANAGER := $(CONFIGS_DIG)/toml_config_manager.py
.PHONY: guard-APP_ENV
guard-APP_ENV:
@if [ -z "$$APP_ENV" ]; then \
echo "APP_ENV is not set. Set APP_ENV before running this command."; \
exit 1; \
fi
.PHONY: env dotenv
env:
@echo APP_ENV=$(APP_ENV)
dotenv: guard-APP_ENV
@$(PYTHON) $(TOML_CONFIG_MANAGER) $(APP_ENV)
# Docker compose
DOCKER_COMPOSE := docker compose
DOCKER_COMPOSE_PRUNE := scripts/makefile/docker_prune.sh
.PHONY: up.db up.db-echo up up.echo down down.total logs.db shell.db prune
up.db: guard-APP_ENV
@echo "APP_ENV=$(APP_ENV)"
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) up -d web_app_db_pg
up.db-echo: guard-APP_ENV
@echo "APP_ENV=$(APP_ENV)"
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) up web_app_db_pg
up: guard-APP_ENV
@echo "APP_ENV=$(APP_ENV)"
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) up -d --build
up.echo: guard-APP_ENV
@echo "APP_ENV=$(APP_ENV)"
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) up --build
down.db: guard-APP_ENV
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) down web_app_db_pg
down: guard-APP_ENV
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) down
down.total: guard-APP_ENV
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) down -v
logs.db: guard-APP_ENV
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) logs -f web_app_db_pg
shell.db: guard-APP_ENV
@cd $(CONFIGS_DIG)/$(APP_ENV) && $(DOCKER_COMPOSE) --env-file .env.$(APP_ENV) exec web_app_db_pg sh
prune:
$(DOCKER_COMPOSE_PRUNE)
# Project structure visualization
PYCACHE_DEL := scripts/makefile/pycache_del.sh
DISHKA_PLOT_DATA := scripts/dishka/plot_dependencies_data.py
.PHONY: pycache-del tree plot-data
pycache-del:
@$(PYCACHE_DEL)
# Clean tree
tree: pycache-del
@tree
# Dishka
plot-data:
@$(PYTHON) $(DISHKA_PLOT_DATA)