diff --git a/pkgs/development/python-modules/langchain/default.nix b/pkgs/development/python-modules/langchain/default.nix index 39cb8a41908d..779b84440936 100644 --- a/pkgs/development/python-modules/langchain/default.nix +++ b/pkgs/development/python-modules/langchain/default.nix @@ -40,18 +40,23 @@ buildPythonPackage rec { pname = "langchain"; - version = "0.3.18"; + version = "0.3.20"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langchain"; tag = "langchain==${version}"; - hash = "sha256-oJ4lUbQqHNEqd9UdgLH0ZmTkdZpUbJ7UNsQyIrs8JvI="; + hash = "sha256-N209wUGdlHkOZynhSSE+ZHylL7cK+8H3PfZIG/wvMd0="; }; sourceRoot = "${src.name}/libs/langchain"; + patches = [ + # blockbuster isn't supported in nixpkgs + ./rm-blockbuster.patch + ]; + build-system = [ pdm-backend ]; buildInputs = [ bash ]; @@ -61,6 +66,10 @@ buildPythonPackage rec { "tenacity" ]; + pythonRemoveDeps = [ + "blockbuster" + ]; + dependencies = [ aiohttp langchain-core diff --git a/pkgs/development/python-modules/langchain/rm-blockbuster.patch b/pkgs/development/python-modules/langchain/rm-blockbuster.patch new file mode 100644 index 000000000000..4022f17a9323 --- /dev/null +++ b/pkgs/development/python-modules/langchain/rm-blockbuster.patch @@ -0,0 +1,68 @@ +diff --git a/tests/unit_tests/conftest.py b/tests/unit_tests/conftest.py +index fed8dbec5..6144ad7b8 100644 +--- a/tests/unit_tests/conftest.py ++++ b/tests/unit_tests/conftest.py +@@ -5,36 +5,36 @@ 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") as bb: +- bb.functions["io.TextIOWrapper.read"].can_block_in( +- "langchain/__init__.py", "" +- ) +- +- for func in ["os.stat", "os.path.abspath"]: +- ( +- bb.functions[func] +- .can_block_in("langchain_core/runnables/base.py", "__repr__") +- .can_block_in( +- "langchain_core/beta/runnables/context.py", "aconfig_with_context" +- ) +- ) +- +- for func in ["os.stat", "io.TextIOWrapper.read"]: +- bb.functions[func].can_block_in( +- "langsmith/client.py", "_default_retry_config" +- ) +- +- for bb_function in bb.functions.values(): +- bb_function.can_block_in( +- "freezegun/api.py", "_get_cached_module_attributes" +- ) +- yield ++# @pytest.fixture(autouse=True) ++# def blockbuster() -> Iterator[None]: ++# with blockbuster_ctx("langchain") as bb: ++# bb.functions["io.TextIOWrapper.read"].can_block_in( ++# "langchain/__init__.py", "" ++# ) ++ ++# for func in ["os.stat", "os.path.abspath"]: ++# ( ++# bb.functions[func] ++# .can_block_in("langchain_core/runnables/base.py", "__repr__") ++# .can_block_in( ++# "langchain_core/beta/runnables/context.py", "aconfig_with_context" ++# ) ++# ) ++ ++# for func in ["os.stat", "io.TextIOWrapper.read"]: ++# bb.functions[func].can_block_in( ++# "langsmith/client.py", "_default_retry_config" ++# ) ++ ++# for bb_function in bb.functions.values(): ++# bb_function.can_block_in( ++# "freezegun/api.py", "_get_cached_module_attributes" ++# ) ++# yield + + + def pytest_addoption(parser: Parser) -> None: