From a400e949710c4ac3643c033a0f5a1e124c2338cc Mon Sep 17 00:00:00 2001 From: Serg Kryvonos Date: Sun, 9 Jun 2024 19:29:37 +0200 Subject: [PATCH] Parameterize Python version (#2348) --- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 12ff50ef7b..e1b3b4dae0 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ DEFAULT_WORKSPACE_DIR = "./workspace" DEFAULT_MODEL = "gpt-4o" CONFIG_FILE = config.toml PRECOMMIT_CONFIG_PATH = "./dev_config/python/.pre-commit-config.yaml" +PYTHON_VERSION = 3.11 # ANSI color codes GREEN=$(shell tput -Txterm setaf 2) @@ -62,10 +63,10 @@ check-system: check-python: @echo "$(YELLOW)Checking Python installation...$(RESET)" - @if command -v python3.11 > /dev/null; then \ - echo "$(BLUE)$(shell python3.11 --version) is already installed.$(RESET)"; \ + @if command -v python$(PYTHON_VERSION) > /dev/null; then \ + echo "$(BLUE)$(shell python$(PYTHON_VERSION) --version) is already installed.$(RESET)"; \ else \ - echo "$(RED)Python 3.11 is not installed. Please install Python 3.11 to continue.$(RESET)"; \ + echo "$(RED)Python $(PYTHON_VERSION) is not installed. Please install Python $(PYTHON_VERSION) to continue.$(RESET)"; \ exit 1; \ fi @@ -112,13 +113,13 @@ check-poetry: echo "$(BLUE)$(shell poetry --version) is already installed.$(RESET)"; \ else \ echo "$(RED)Poetry 1.8 or later is required. You can install poetry by running the following command, then adding Poetry to your PATH:"; \ - echo "$(RED) curl -sSL https://install.python-poetry.org | python3 -$(RESET)"; \ + echo "$(RED) curl -sSL https://install.python-poetry.org | python$(PYTHON_VERSION) -$(RESET)"; \ echo "$(RED)More detail here: https://python-poetry.org/docs/#installing-with-the-official-installer$(RESET)"; \ exit 1; \ fi; \ else \ echo "$(RED)Poetry is not installed. You can install poetry by running the following command, then adding Poetry to your PATH:"; \ - echo "$(RED) curl -sSL https://install.python-poetry.org | python3.11 -$(RESET)"; \ + echo "$(RED) curl -sSL https://install.python-poetry.org | python$(PYTHON_VERSION) -$(RESET)"; \ echo "$(RED)More detail here: https://python-poetry.org/docs/#installing-with-the-official-installer$(RESET)"; \ exit 1; \ fi @@ -130,7 +131,7 @@ pull-docker-image: install-python-dependencies: @echo "$(GREEN)Installing Python dependencies...$(RESET)" - poetry env use python3.11 + poetry env use python$(PYTHON_VERSION) @if [ "$(shell uname)" = "Darwin" ]; then \ echo "$(BLUE)Installing chroma-hnswlib...$(RESET)"; \ export HNSWLIB_NO_NATIVE=1; \