From ca008a13468e55d8dba0a8050a3ff14e17cc655f Mon Sep 17 00:00:00 2001 From: Daniel Gines Date: Thu, 8 Aug 2024 12:15:41 -0300 Subject: [PATCH] fix: update PYTHON_REQUIRED extraction to correctly capture Python version (#3199) * Updates and changes to the Makefile: 1. Added removal of `frontend` directory inside `src/backend/base/langflow/` and `build` directory inside `src/frontend/` to the `clean_npm_cache` target. 2. Added descriptive comments for the `build_and_install`, `build_and_run`, `fix_codespell`, `setup_poetry`, `unit_tests`, `integration_tests`, and `tests_frontend` targets. Looking forward to your feedback. * Improvements: Structure and Functionality Improvements - Reorganized commands to facilitate understanding of the structure - Enhanced check_tools to detect the Python version - Added a multi-environment script to support check_tools - make init now builds the frontend and runs the application - Aesthetic improvements in output messages TO-DO: - Reorganize container-related commands - Reorganize other miscellaneous utilities - Document usage in the application docs - Prepare the dev environment following the maintainers' recommended practices * Removed pre-commit as it is no longer used. * Restored 'patch' command in Makefile, it updates the 'pyproject.toml' with the new project version. * fix: update PYTHON_REQUIRED extraction to correctly capture Python version Changed the method of extracting the required Python version from `pyproject.toml`: - Old method: `PYTHON_REQUIRED=$(shell grep "^python" pyproject.toml | sed -n 's/.*"\(.*\)"$$/\1/p')` - New method: `PYTHON_REQUIRED=$(shell grep '^python[[:space:]]*=' pyproject.toml | sed -n 's/.*"\([^"]*\)".*/\1/p')` The old method of capturing the Python version was too broad and could inadvertently match other dependencies starting with "python" (e.g., `python-socketio`, `python-dotenv`). This could lead to incorrect extraction of the required Python version, potentially causing version mismatches and failures in environment setup. * fix: update PYTHON_REQUIRED extraction to correctly capture Python version Changed the method of extracting the required Python version from `pyproject.toml`: - Old method: `PYTHON_REQUIRED=$(shell grep "^python" pyproject.toml | sed -n 's/.*"\(.*\)"$$/\1/p')` - New method: `PYTHON_REQUIRED=$(shell grep '^python[[:space:]]*=' pyproject.toml | sed -n 's/.*"\([^"]*\)".*/\1/p')` The old method of capturing the Python version was too broad and could inadvertently match other dependencies starting with "python" (e.g., `python-socketio`, `python-dotenv`). This could lead to incorrect extraction of the required Python version, potentially causing version mismatches and failures in environment setup. --------- Co-authored-by: Gabriel Luiz Freitas Almeida --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 484fc27bd..6e84e64c9 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ DOCKERFILE=docker/build_and_push.Dockerfile DOCKERFILE_BACKEND=docker/build_and_push_backend.Dockerfile DOCKERFILE_FRONTEND=docker/frontend/build_and_push_frontend.Dockerfile DOCKER_COMPOSE=docker_example/docker-compose.yml -PYTHON_REQUIRED=$(shell grep "^python" pyproject.toml | sed -n 's/.*"\(.*\)"$$/\1/p') +PYTHON_REQUIRED=$(shell grep '^python[[:space:]]*=' pyproject.toml | sed -n 's/.*"\([^"]*\)".*/\1/p') RED=\033[0;31m NC=\033[0m # No Color GREEN=\033[0;32m