@@ -17,9 +17,14 @@ INFRA_INIT_SERVICES ?=
1717# -----------------------------
1818# Internal vars / aliases
1919# -----------------------------
20- PYTHON_BIN := python
2120DOCKER_COMPOSE := docker compose -p $(PROJECT_NAME )
22- DOCKER_COMPOSE_PRUNE := scripts/makefile/docker_prune.sh
21+ PIP_AUDIT := scripts/makefile/pip_audit.sh
22+ SLOTSCHECK := scripts/makefile/slotscheck.sh
23+ DOCKER_ENV := scripts/makefile/docker_env.sh
24+ LOCAL_ENV := scripts/makefile/local_env.sh
25+ DOCKER_PRUNE := scripts/makefile/docker_prune.sh
26+ PYCACHE_DEL := scripts/makefile/pycache_del.sh
27+ DISHKA_PLOT_DATA := scripts/dishka/plot_dependencies_data.py
2328
2429# Test stack is isolated by project name
2530TEST_PROJECT ?= $(PROJECT_NAME ) -test
@@ -52,25 +57,20 @@ PYTEST_ARGS_COV_DOCKER := \
5257# Safety
5358.PHONY : pip-audit
5459pip-audit :
55- tmp=$$(mktemp -d ) ; trap ' rm -rf "$$tmp"' EXIT; \
56- uv -qq export --format pylock.toml -o " $$ tmp/pylock.toml" ; \
57- pip-audit --locked " $$ tmp" \
58- || echo " WARNING: pip-audit found vulnerabilities (non-blocking)" >&2
60+ $(PIP_AUDIT )
5961
6062# Code quality
6163.PHONY : slotscheck lint test check
6264slotscheck :
63- slotscheck $(SLOTSCHECK_TARGET ) 2>&1 | tee /dev/stderr \
64- | { grep -m1 " Failed to import" || true ; } | cut -d" '" -f2 \
65- | xargs -r -n1 $(PYTHON_BIN ) -c ' import importlib,sys; importlib.import_module(sys.argv[1])'
65+ $(SLOTSCHECK ) src
6666
6767lint :
6868 ruff check --fix
6969 ruff format
7070 tombi format
7171 tombi lint
7272 deptry
73- $(MAKE ) slotscheck SLOTSCHECK_TARGET=src
73+ $(MAKE ) slotscheck
7474 lint-imports
7575 mypy
7676
@@ -85,33 +85,10 @@ check: lint test
8585# Docker compose
8686.PHONY : docker-env local-env upd up upd-local up-local down stop-all
8787docker-env :
88- { \
89- echo " # This .env file is generated automatically for DOCKER environment by Makefile." ; \
90- echo " # Do not edit it directly; edit env.example / .secrets and Makefile instead." ; \
91- echo ; \
92- cat env.example; \
93- if [ -f .secrets ]; then \
94- echo ; \
95- echo " # --- secrets from .secrets (not committed) ---" ; \
96- cat .secrets; \
97- fi ; \
98- } > .env
88+ $(DOCKER_ENV )
9989
10090local-env :
101- { \
102- echo " # This .env file is generated automatically for LOCAL environment by Makefile." ; \
103- echo " # Do not edit it directly; edit env.example / .secrets and Makefile instead." ; \
104- echo ; \
105- sed \
106- -e ' s|^EXAMPLE_SERVICE_URL=.*|EXAMPLE_SERVICE_URL=http://127.0.0.1:51999|' \
107- -e ' s|^POSTGRES_HOST=.*|POSTGRES_HOST=127.0.0.1|' \
108- env.example; \
109- if [ -f .secrets ]; then \
110- echo ; \
111- echo " # --- secrets from .secrets (not committed) ---" ; \
112- cat .secrets; \
113- fi ; \
114- } > .env
91+ $(LOCAL_ENV )
11592
11693upd : docker-env
11794 $(DOCKER_COMPOSE ) up -d --build --force-recreate
@@ -158,18 +135,15 @@ test-docker: docker-env
158135
159136.PHONY : prune
160137prune :
161- $(DOCKER_COMPOSE_PRUNE )
138+ $(DOCKER_PRUNE )
162139
163140# Project structure visualization
164141.PHONY : pycache-del tree plot-data
165- PYCACHE_DEL := scripts/makefile/pycache_del.sh
166- DISHKA_PLOT_DATA := scripts/dishka/plot_dependencies_data.py
167-
168142pycache-del :
169- @ $(PYCACHE_DEL )
143+ $(PYCACHE_DEL )
170144
171145tree : pycache-del
172- @ tree
146+ tree
173147
174148plot-data :
175- @ $( PYTHON_BIN ) $(DISHKA_PLOT_DATA )
149+ APP_LOGGING_LEVEL=CRITICAL python $(DISHKA_PLOT_DATA )
0 commit comments