@@ -8,69 +8,56 @@ VENV := $(shell echo $${VIRTUAL_ENV-.venv})
88INSTALL_STAMP = $(VENV ) /.install.stamp
99DOTENV_FILE = .env
1010
11- .PHONY : help
11+
12+ INSTALL_STAMP := .install.stamp
13+ UV := $(shell command -v uv 2> /dev/null)
14+
1215help :
13- @echo " Usage: make RULE"
14- @echo " "
15- @echo " JBI make rules:"
16- @echo " "
17- @echo " Local"
18- @echo " clean - clean local cache folders"
19- @echo " format - run linting checks, fix in place"
20- @echo " lint - run linting checks"
21- @echo " start - run the API service locally"
22- @echo " test - run test suite"
23- @echo " "
24- @echo " Docker"
25- @echo " build - build docker container"
26- @echo " docker-start - run the API service through docker"
27- @echo " docker-shell - open a shell in the web container"
28- @echo " "
29- @echo " help - see this text"
16+ @echo " Please use 'make <target>' where <target> is one of the following commands.\n"
17+ @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
18+ @echo " \nCheck the Makefile to know exactly what each target is doing."
3019
3120.PHONY : clean
32- clean :
21+ clean : # # Delete cache files
3322 find . -name " __pycache__" | xargs rm -rf
3423 rm -rf .mypy_cache .ruff_cache .coverage .venv
3524
36- $(VENV ) /bin/python :
37- python3 -m venv $(VENV )
38-
39- install : $(VENV ) /bin/python $(INSTALL_STAMP )
40- $(INSTALL_STAMP ) : poetry.lock
41- @if [ -z $( shell command -v poetry 2> /dev/null) ]; then echo " Poetry could not be found. See https://python-poetry.org/docs/" ; exit 2; fi
42- POETRY_VIRTUALENVS_IN_PROJECT=1 poetry install --with dev --no-root
25+ install : $(INSTALL_STAMP )
26+ $(INSTALL_STAMP ) : pyproject.toml uv.lock # # Install dependencies
27+ @if [ -z $( UV) ]; then echo " uv could not be found. See https://docs.astral.sh/uv/" ; exit 2; fi
28+ $(UV ) --version
29+ $(UV ) sync --frozen --verbose
4330 touch $(INSTALL_STAMP )
4431
4532.PHONY : build
46- build :
33+ build : # # Build docker container
4734 docker-compose build \
4835 --build-arg userid=${_UID} --build-arg groupid=${_GID}
4936
5037.PHONY : format
51- format : $(INSTALL_STAMP )
38+ format : $(INSTALL_STAMP ) # # Format code base
5239 bin/lint.sh lint --fix
5340 bin/lint.sh format --fix
5441
5542.PHONY : lint
56- lint : $(INSTALL_STAMP )
43+ lint : $(INSTALL_STAMP ) # # Analyze code base
5744 bin/lint.sh
5845
5946.PHONY : start
60- start : $(INSTALL_STAMP ) $(DOTENV_FILE )
61- poetry run python -m asgi
47+ start : $(INSTALL_STAMP ) $(DOTENV_FILE ) # # Start local
48+ $( UV ) run python -m asgi
6249
63- $(DOTENV_FILE ) :
50+ $(DOTENV_FILE ) : # # Initialize default configuration
6451 cp .env.example $(DOTENV_FILE )
6552
6653.PHONY : docker-shell
67- docker-shell : $(DOTENV_FILE )
54+ docker-shell : $(DOTENV_FILE ) # # Run shell from container
6855 docker compose run --rm web /bin/sh
6956
7057.PHONY : docker-start
71- docker-start : $(DOTENV_FILE )
58+ docker-start : $(DOTENV_FILE ) # # Start container
7259 docker compose up
7360
7461.PHONY : test
75- test : $(INSTALL_STAMP )
76- bin/test.sh
62+ test : $(INSTALL_STAMP ) # # Run unit tests
63+ $( UV ) run pytest tests -n auto --cov-report term-missing --cov-fail-under 75 --cov jbi --cov checks
0 commit comments