From dbaa8a1c6f590317f4badc0fe600769b6712ef00 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 23 Jun 2025 10:46:55 -0300 Subject: [PATCH] refactor: simplify init target by removing cache cleanup and adding pre-commit hook (#8590) * build: add pyyaml dependency * refactor: simplify init command by removing cache cleaning and langflow run call * refactor: simplify init target by removing cache cleanup and adding pre-commit hook * refactor: update langchain_core.prompts import paths to use specific modules --------- Co-authored-by: Edwin Jose --- Makefile | 5 ++--- pyproject.toml | 1 + src/backend/base/langflow/schema/message.py | 3 ++- uv.lock | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1584017b0..a8b5cc3b7 100644 --- a/Makefile +++ b/Makefile @@ -75,12 +75,11 @@ build_frontend: ## build the frontend static files @cp -r src/frontend/build/. src/backend/base/langflow/frontend @echo '==== Frontend build complete ====' -init: check_tools clean_python_cache clean_npm_cache ## initialize the project +init: check_tools ## initialize the project @make install_backend @make install_frontend - @make build_frontend + @uvx pre-commit install @echo "$(GREEN)All requirements are installed.$(NC)" - @uv run langflow run ###################### # CLEAN PROJECT diff --git a/pyproject.toml b/pyproject.toml index 29c67dc0a..19b9c9fed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -173,6 +173,7 @@ dev = [ 'elevenlabs>=1.52.0; python_version != "3.12"', "faker>=37.0.0", "pytest-timeout>=2.3.1", + "pyyaml>=6.0.2", ] [tool.uv.sources] diff --git a/src/backend/base/langflow/schema/message.py b/src/backend/base/langflow/schema/message.py index 90e8834ae..e0814747e 100644 --- a/src/backend/base/langflow/schema/message.py +++ b/src/backend/base/langflow/schema/message.py @@ -12,7 +12,8 @@ from uuid import UUID from fastapi.encoders import jsonable_encoder from langchain_core.load import load from langchain_core.messages import AIMessage, BaseMessage, HumanMessage, SystemMessage -from langchain_core.prompts import BaseChatPromptTemplate, ChatPromptTemplate, PromptTemplate +from langchain_core.prompts.chat import BaseChatPromptTemplate, ChatPromptTemplate +from langchain_core.prompts.prompt import PromptTemplate from loguru import logger from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_serializer, field_validator diff --git a/uv.lock b/uv.lock index b230d0b60..0dc036772 100644 --- a/uv.lock +++ b/uv.lock @@ -4774,6 +4774,7 @@ dev = [ { name = "pytest-sugar" }, { name = "pytest-timeout" }, { name = "pytest-xdist" }, + { name = "pyyaml" }, { name = "requests" }, { name = "respx" }, { name = "ruff" }, @@ -4946,6 +4947,7 @@ dev = [ { name = "pytest-sugar", specifier = ">=1.0.0" }, { name = "pytest-timeout", specifier = ">=2.3.1" }, { name = "pytest-xdist", specifier = ">=3.6.0" }, + { name = "pyyaml", specifier = ">=6.0.2" }, { name = "requests", specifier = ">=2.32.0" }, { name = "respx", specifier = ">=0.21.1" }, { name = "ruff", specifier = ">=0.9.7,<0.10" },