2023-06-28 14:28:52 -04:00
|
|
|
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
APP_NAME:=gpt4all_api
|
|
|
|
PYTHON:=python3.8
|
2023-07-21 15:13:29 -04:00
|
|
|
SHELL := /bin/bash
|
2023-06-28 14:28:52 -04:00
|
|
|
|
|
|
|
all: dependencies
|
|
|
|
|
|
|
|
fresh: clean dependencies
|
|
|
|
|
|
|
|
testenv: clean_testenv test_build
|
2023-07-21 15:13:29 -04:00
|
|
|
docker compose -f docker-compose.yaml up --build
|
|
|
|
|
|
|
|
testenv_gpu: clean_testenv test_build
|
|
|
|
docker compose -f docker-compose.yaml -f docker-compose.gpu.yaml up --build
|
2023-06-28 14:28:52 -04:00
|
|
|
|
|
|
|
testenv_d: clean_testenv test_build
|
2023-11-11 23:27:32 -05:00
|
|
|
docker compose env up --build -d
|
2023-06-28 14:28:52 -04:00
|
|
|
|
|
|
|
test:
|
2023-07-21 15:13:29 -04:00
|
|
|
docker compose exec $(APP_NAME) pytest -svv --disable-warnings -p no:cacheprovider /app/tests
|
2023-06-28 14:28:52 -04:00
|
|
|
|
|
|
|
test_build:
|
2023-07-21 15:13:29 -04:00
|
|
|
DOCKER_BUILDKIT=1 docker build -t $(APP_NAME) --progress plain -f $(APP_NAME)/Dockerfile.buildkit .
|
2023-06-28 14:28:52 -04:00
|
|
|
|
|
|
|
clean_testenv:
|
|
|
|
docker compose down -v
|
|
|
|
|
|
|
|
fresh_testenv: clean_testenv testenv
|
|
|
|
|
|
|
|
venv:
|
2023-11-11 23:27:32 -05:00
|
|
|
if [ ! -d $(ROOT_DIR)/venv ]; then $(PYTHON) -m venv $(ROOT_DIR)/venv; fi
|
2023-06-28 14:28:52 -04:00
|
|
|
|
|
|
|
dependencies: venv
|
2023-11-11 23:27:32 -05:00
|
|
|
source $(ROOT_DIR)/venv/bin/activate; $(PYTHON) -m pip install -r $(ROOT_DIR)/$(APP_NAME)/requirements.txt
|
2023-06-28 14:28:52 -04:00
|
|
|
|
|
|
|
clean: clean_testenv
|
|
|
|
# Remove existing environment
|
2023-11-11 23:27:32 -05:00
|
|
|
rm -rf $(ROOT_DIR)/venv;
|
2023-06-28 14:28:52 -04:00
|
|
|
rm -rf $(ROOT_DIR)/$(APP_NAME)/*.pyc;
|
|
|
|
|
|
|
|
|
2023-07-21 15:13:29 -04:00
|
|
|
black:
|
2023-11-11 23:27:32 -05:00
|
|
|
source $(ROOT_DIR)/venv/bin/activate; black -l 120 -S --target-version py38 $(APP_NAME)
|
2023-07-21 15:13:29 -04:00
|
|
|
|
|
|
|
isort:
|
2023-11-11 23:27:32 -05:00
|
|
|
source $(ROOT_DIR)/venv/bin/activate; isort --ignore-whitespace --atomic -w 120 $(APP_NAME)
|