diff --git a/pkgs/development/python-modules/langchain-core/default.nix b/pkgs/development/python-modules/langchain-core/default.nix index 0903e6d2d509..9226ed18530e 100644 --- a/pkgs/development/python-modules/langchain-core/default.nix +++ b/pkgs/development/python-modules/langchain-core/default.nix @@ -17,6 +17,7 @@ typing-extensions, # tests + blockbuster, freezegun, grandalf, httpx, @@ -32,31 +33,22 @@ buildPythonPackage rec { pname = "langchain-core"; - version = "0.3.49"; + version = "0.3.56"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langchain"; tag = "langchain-core==${version}"; - hash = "sha256-s1vZ7G6Wzywf3euwX/RdCPkgzxvZTYVG0udGpHTIiQc="; + hash = "sha256-gsjYr22Phb71oKN4iVGsi6r1iETDhFHCKKOiwp0SuLU="; }; sourceRoot = "${src.name}/libs/core"; - patches = [ - # Remove dependency on blockbuster (not available in nixpkgs due to dependency on forbiddenfruit) - ./rm-blockbuster.patch - ]; - build-system = [ pdm-backend ]; pythonRelaxDeps = [ "tenacity" ]; - pythonRemoveDependencies = [ - "blockbuster" - ]; - dependencies = [ jsonpatch langsmith @@ -73,6 +65,7 @@ buildPythonPackage rec { doCheck = false; nativeCheckInputs = [ + blockbuster freezegun grandalf httpx diff --git a/pkgs/development/python-modules/langchain-core/rm-blockbuster.patch b/pkgs/development/python-modules/langchain-core/rm-blockbuster.patch deleted file mode 100644 index a7dc2af18af4..000000000000 --- a/pkgs/development/python-modules/langchain-core/rm-blockbuster.patch +++ /dev/null @@ -1,155 +0,0 @@ -diff --git a/pyproject.toml b/pyproject.toml -index a2cfc7adf..db37bd74a 100644 ---- a/pyproject.toml -+++ b/pyproject.toml -@@ -53,7 +53,7 @@ test = [ - "responses<1.0.0,>=0.25.0", - "pytest-socket<1.0.0,>=0.7.0", - "pytest-xdist<4.0.0,>=3.6.1", -- "blockbuster~=1.5.18", -+ # "blockbuster~=1.5.18", - "numpy<2.0.0,>=1.24.0; python_version < \"3.12\"", - "numpy<3,>=1.26.0; python_version >= \"3.12\"", - "langchain-tests", -diff --git a/tests/unit_tests/conftest.py b/tests/unit_tests/conftest.py -index 6438c3037..aa301c337 100644 ---- a/tests/unit_tests/conftest.py -+++ b/tests/unit_tests/conftest.py -@@ -5,35 +5,35 @@ from importlib import util - from uuid import UUID - - import pytest --from blockbuster import BlockBuster, blockbuster_ctx -+# from blockbuster import BlockBuster, blockbuster_ctx - from pytest import Config, Function, Parser - from pytest_mock import MockerFixture - - --@pytest.fixture(autouse=True) --def blockbuster() -> Iterator[BlockBuster]: -- with blockbuster_ctx("langchain_core") as bb: -- for func in ["os.stat", "os.path.abspath"]: -- ( -- bb.functions[func] -- .can_block_in("langchain_core/_api/internal.py", "is_caller_internal") -- .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 bb -+# @pytest.fixture(autouse=True) -+# def blockbuster() -> Iterator[BlockBuster]: -+# with blockbuster_ctx("langchain_core") as bb: -+# for func in ["os.stat", "os.path.abspath"]: -+# ( -+# bb.functions[func] -+# .can_block_in("langchain_core/_api/internal.py", "is_caller_internal") -+# .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 bb - - - def pytest_addoption(parser: Parser) -> None: -diff --git a/tests/unit_tests/language_models/chat_models/test_rate_limiting.py b/tests/unit_tests/language_models/chat_models/test_rate_limiting.py -index ee6eefba9..4d39da58d 100644 ---- a/tests/unit_tests/language_models/chat_models/test_rate_limiting.py -+++ b/tests/unit_tests/language_models/chat_models/test_rate_limiting.py -@@ -2,17 +2,17 @@ import time - from typing import Optional as Optional - - import pytest --from blockbuster import BlockBuster -+# from blockbuster import BlockBuster - - from langchain_core.caches import InMemoryCache - from langchain_core.language_models import GenericFakeChatModel - from langchain_core.rate_limiters import InMemoryRateLimiter - - --@pytest.fixture(autouse=True) --def deactivate_blockbuster(blockbuster: BlockBuster) -> None: -- # Deactivate BlockBuster to not disturb the rate limiter timings -- blockbuster.deactivate() -+# @pytest.fixture(autouse=True) -+# def deactivate_blockbuster(blockbuster: BlockBuster) -> None: -+# # Deactivate BlockBuster to not disturb the rate limiter timings -+# blockbuster.deactivate() - - - def test_rate_limit_invoke() -> None: -diff --git a/tests/unit_tests/runnables/test_runnable_events_v2.py b/tests/unit_tests/runnables/test_runnable_events_v2.py -index e1e1f37b9..21d2f1600 100644 ---- a/tests/unit_tests/runnables/test_runnable_events_v2.py -+++ b/tests/unit_tests/runnables/test_runnable_events_v2.py -@@ -15,7 +15,7 @@ from typing import ( - ) - - import pytest --from blockbuster import BlockBuster -+# from blockbuster import BlockBuster - from pydantic import BaseModel - - from langchain_core.callbacks import CallbackManagerForRetrieverRun, Callbacks -@@ -2005,7 +2005,7 @@ EXPECTED_EVENTS = [ - - async def test_sync_in_async_stream_lambdas(blockbuster: BlockBuster) -> None: - """Test invoking nested runnable lambda.""" -- blockbuster.deactivate() -+ # blockbuster.deactivate() - - def add_one(x: int) -> int: - return x + 1 -diff --git a/tests/unit_tests/test_setup.py b/tests/unit_tests/test_setup.py -index 1df3c73a2..58e94de9a 100644 ---- a/tests/unit_tests/test_setup.py -+++ b/tests/unit_tests/test_setup.py -@@ -1,15 +1,15 @@ - import time - - import pytest --from blockbuster import BlockingError -+# from blockbuster import BlockingError - - from langchain_core import sys_info - - --async def test_blockbuster_setup() -> None: -- """Check if blockbuster is correctly setup.""" -- # Blocking call outside of langchain_core is allowed. -- time.sleep(0.01) # noqa: ASYNC251 -- with pytest.raises(BlockingError): -- # Blocking call from langchain_core raises BlockingError. -- sys_info.print_sys_info() -+# async def test_blockbuster_setup() -> None: -+# """Check if blockbuster is correctly setup.""" -+# # Blocking call outside of langchain_core is allowed. -+# time.sleep(0.01) # noqa: ASYNC251 -+# with pytest.raises(BlockingError): -+# # Blocking call from langchain_core raises BlockingError. -+# sys_info.print_sys_info()