Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python312Packages.langchain-*: 250306 update #387775

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pkgs/development/python-modules/langchain-community/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -70,7 +80,6 @@ buildPythonPackage rec {
sqlalchemy
tenacity
];

pythonImportsCheck = [ "langchain_community" ];

nativeCheckInputs = [
Expand Down Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
15 changes: 13 additions & 2 deletions pkgs/development/python-modules/langchain-core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,31 @@

buildPythonPackage rec {
pname = "langchain-core";
version = "0.3.35";
version = "0.3.41";
pyproject = true;

src = fetchFromGitHub {
owner = "langchain-ai";
repo = "langchain";
tag = "langchain-core==${version}";
hash = "sha256-bwNSeXQJsfbc4c8mSd0GtlVsQ/HRilNiyP6XLcEzL20=";
hash = "sha256-KtDmXNA+h5saaczf6aj6o4iCtdJHmWhn7KjOa34kwf0=";
};

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
Expand Down Expand Up @@ -148,6 +157,8 @@ buildPythonPackage rec {
"test_rate_limit_astream"
];

disabledTestPaths = [ "tests/unit_tests/runnables/test_runnable_events_v2.py" ];

meta = {
description = "Building applications with LLMs through composability";
homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/core";
Expand Down
155 changes: 155 additions & 0 deletions pkgs/development/python-modules/langchain-core/rm-blockbuster.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
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()
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/langchain-ollama/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

buildPythonPackage rec {
pname = "langchain-ollama";
version = "0.2.2";
version = "0.2.3";
pyproject = true;

src = fetchFromGitHub {
owner = "langchain-ai";
repo = "langchain";
tag = "langchain-ollama==${version}";
hash = "sha256-Ex8GndMHPHwSSMKu1JxnfGpRj55fh3TR19b3E+KrLUs=";
hash = "sha256-G7faykRlpfmafSnSe/CdPW87uCtofBp7mLzbxZgBBhM=";
};

sourceRoot = "${src.name}/libs/partners/ollama";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/langchain-openai/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

buildPythonPackage rec {
pname = "langchain-openai";
version = "0.3.5";
version = "0.3.7";
pyproject = true;

src = fetchFromGitHub {
owner = "langchain-ai";
repo = "langchain";
tag = "langchain-openai==${version}";
hash = "sha256-we9LPZeR/eIr+4uDXbBlTm43iapC+MCB0BrbH49Uknw=";
hash = "sha256-ZDn8x2eC0J5X+juohKohl3WFENxZkafJAPtLj9kSiBY=";
};

sourceRoot = "${src.name}/libs/partners/openai";
Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/python-modules/langchain-tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
fetchFromGitHub,

# build-system
poetry-core,
pdm-backend,

# dependencies
httpx,
Expand All @@ -23,19 +23,19 @@

buildPythonPackage rec {
pname = "langchain-tests";
version = "0.3.8";
version = "0.3.13";
pyproject = true;

src = fetchFromGitHub {
owner = "langchain-ai";
repo = "langchain";
tag = "langchain-tests==${version}";
hash = "sha256-IZJo4EZFVKinBQdacM5xQ8ip3qTB64eqwZ9n+Z5mzWY=";
hash = "sha256-N209wUGdlHkOZynhSSE+ZHylL7cK+8H3PfZIG/wvMd0=";
};

sourceRoot = "${src.name}/libs/standard-tests";

build-system = [ poetry-core ];
build-system = [ pdm-backend ];

dependencies = [
httpx
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/langchain/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

buildPythonPackage rec {
pname = "langchain";
version = "0.3.18";
version = "0.3.20";
pyproject = true;

src = fetchFromGitHub {
Expand Down