From 7860dffa09aa28bfeb53d48f6625184f342c7950 Mon Sep 17 00:00:00 2001 From: Fangyin Cheng Date: Wed, 3 Jan 2024 10:21:40 +0800 Subject: [PATCH] build: Improve build performance (#1011) --- Makefile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 5aa3d01b2..74d40075d 100644 --- a/Makefile +++ b/Makefile @@ -10,14 +10,27 @@ else VENV_BIN=$(VENV)/bin endif -setup: ## Set up the Python development environment +setup: $(VENV)/bin/activate + +$(VENV)/bin/activate: $(VENV)/.venv-timestamp + +$(VENV)/.venv-timestamp: setup.py + # Create new virtual environment if setup.py has changed python3 -m venv $(VENV) $(VENV_BIN)/pip install --upgrade pip $(VENV_BIN)/pip install -r requirements/dev-requirements.txt $(VENV_BIN)/pip install -r requirements/lint-requirements.txt + touch $(VENV)/.venv-timestamp + +testenv: $(VENV)/.testenv + +$(VENV)/.testenv: $(VENV)/bin/activate + # $(VENV_BIN)/pip install -e ".[framework]" + # $(VENV_BIN)/pip install -e ".[knowledge]" + # the openai optional dependency is include framework and knowledge dependencies + $(VENV_BIN)/pip install -e ".[openai]" + touch $(VENV)/.testenv -testenv: setup ## Set up the Python test environment - $(VENV_BIN)/pip install -e ".[default]" .PHONY: fmt fmt: setup ## Format Python code @@ -51,8 +64,7 @@ fmt: setup ## Format Python code .PHONY: pre-commit pre-commit: fmt test ## Run formatting and unit tests before committing -.PHONY: test -test: testenv ## Run unit tests +test: $(VENV)/.testenv ## Run unit tests $(VENV_BIN)/pytest dbgpt .PHONY: coverage