From a1d97e7b3cf727ad83e484376b5afc932af0dd96 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Thu, 6 Mar 2025 15:24:16 -0800 Subject: [PATCH] python312Packages.langchain-community: 0.3.17 -> 0.3.19 --- .../langchain-community/default.nix | 17 +++++++-- .../langchain-community/rm-blockbuster.patch | 37 +++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/python-modules/langchain-community/rm-blockbuster.patch diff --git a/pkgs/development/python-modules/langchain-community/default.nix b/pkgs/development/python-modules/langchain-community/default.nix index 0af7ae2e6267..97bb3c06e8d4 100644 --- a/pkgs/development/python-modules/langchain-community/default.nix +++ b/pkgs/development/python-modules/langchain-community/default.nix @@ -36,26 +36,36 @@ buildPythonPackage rec { pname = "langchain-community"; - version = "0.3.17"; + version = "0.3.19"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langchain"; tag = "langchain-community==${version}"; - hash = "sha256-+10Q8em74G5RU6VtDqhQJuDsjJ4/EjGM4a3xQzs3Qzo="; + hash = "sha256-U7L60GyxRQL9ze22Wy7g6ZdI/IFyAtUe1bRCconv6pg="; }; sourceRoot = "${src.name}/libs/community"; build-system = [ pdm-backend ]; + patches = [ + # Remove dependency on blockbuster (not available in nixpkgs due to dependency on forbiddenfruit) + ./rm-blockbuster.patch + ]; + pythonRelaxDeps = [ + "langchain" # Can fail during updates where building sees the old langchain "numpy" "pydantic-settings" "tenacity" ]; + pythonRemoveDeps = [ + "blockbuster" + ]; + dependencies = [ aiohttp dataclasses-json @@ -70,7 +80,6 @@ buildPythonPackage rec { sqlalchemy tenacity ]; - pythonImportsCheck = [ "langchain_community" ]; nativeCheckInputs = [ @@ -111,6 +120,8 @@ buildPythonPackage rec { "test_proper_inputs" # pydantic.errors.PydanticUserError: `NatBotChain` is not fully defined; you should define `BaseCache`, then call `NatBotChain.model_rebuild()`. "test_variable_key_naming" + # Fails due to the lack of blockbuster + "test_group_dependencies" ]; meta = { diff --git a/pkgs/development/python-modules/langchain-community/rm-blockbuster.patch b/pkgs/development/python-modules/langchain-community/rm-blockbuster.patch new file mode 100644 index 000000000000..a8d4011210aa --- /dev/null +++ b/pkgs/development/python-modules/langchain-community/rm-blockbuster.patch @@ -0,0 +1,37 @@ +diff --git a/tests/unit_tests/conftest.py b/tests/unit_tests/conftest.py +index 63f3a83e0..61c2d6ce3 100644 +--- a/tests/unit_tests/conftest.py ++++ b/tests/unit_tests/conftest.py +@@ -5,22 +5,22 @@ from importlib import util + from typing import Dict, Sequence + + import pytest +-from blockbuster import blockbuster_ctx ++# from blockbuster import blockbuster_ctx + from pytest import Config, Function, Parser + + +-@pytest.fixture(autouse=True) +-def blockbuster() -> Iterator[None]: +- with blockbuster_ctx("langchain_community") as bb: +- ( +- bb.functions["os.stat"] +- .can_block_in("langchain_community/utils/openai.py", "is_openai_v1") +- .can_block_in("httpx/_client.py", "_init_transport") +- ) +- bb.functions["os.path.abspath"].can_block_in( +- "sqlalchemy/dialects/sqlite/pysqlite.py", "create_connect_args" +- ) +- yield ++# @pytest.fixture(autouse=True) ++# def blockbuster() -> Iterator[None]: ++# with blockbuster_ctx("langchain_community") as bb: ++# ( ++# bb.functions["os.stat"] ++# .can_block_in("langchain_community/utils/openai.py", "is_openai_v1") ++# .can_block_in("httpx/_client.py", "_init_transport") ++# ) ++# bb.functions["os.path.abspath"].can_block_in( ++# "sqlalchemy/dialects/sqlite/pysqlite.py", "create_connect_args" ++# ) ++# yield