From 536e6566ffe1edea82d4cdca537d38bd9e4930a0 Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 May 2024 10:29:56 +0900 Subject: [PATCH 1/5] python311Packages.langchain-core: add updateScript --- .../python-modules/langchain-community/default.nix | 4 ++++ .../python-modules/langchain-core/default.nix | 14 ++++++++++++++ .../langchain-text-splitters/default.nix | 4 ++++ .../python-modules/langchain/default.nix | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/pkgs/development/python-modules/langchain-community/default.nix b/pkgs/development/python-modules/langchain-community/default.nix index e8e028570abd..947d23fb21fd 100644 --- a/pkgs/development/python-modules/langchain-community/default.nix +++ b/pkgs/development/python-modules/langchain-community/default.nix @@ -52,6 +52,10 @@ buildPythonPackage rec { # PyPI source does not have tests doCheck = false; + passthru = { + updateScript = langchain-core.updateScript; + }; + meta = with lib; { description = "Community contributed LangChain integrations"; homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/community"; diff --git a/pkgs/development/python-modules/langchain-core/default.nix b/pkgs/development/python-modules/langchain-core/default.nix index 8cfa8cafd9ee..d2ee9ee504cf 100644 --- a/pkgs/development/python-modules/langchain-core/default.nix +++ b/pkgs/development/python-modules/langchain-core/default.nix @@ -13,6 +13,7 @@ pyyaml, requests, tenacity, + writeScript, }: buildPythonPackage rec { @@ -53,6 +54,19 @@ buildPythonPackage rec { # PyPI source does not have tests doCheck = false; + passthru = { + updateScript = writeScript "update.sh" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p nix-update + + set -eu -o pipefail + nix-update --commit --version-regex 'langchain-core==(.*)' python3Packages.langchain-core + nix-update --commit --version-regex 'langchain-text-splitters==(.*)' python3Packages.langchain-text-splitters + nix-update --commit --version-regex 'langchain==(.*)' python3Packages.langchain + nix-update --commit --version-regex 'langchain-community==(.*)' python3Packages.langchain-community + ''; + }; + meta = with lib; { description = "Building applications with LLMs through composability"; homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/core"; diff --git a/pkgs/development/python-modules/langchain-text-splitters/default.nix b/pkgs/development/python-modules/langchain-text-splitters/default.nix index 3f8fa837af7a..6084bbf5ee0b 100644 --- a/pkgs/development/python-modules/langchain-text-splitters/default.nix +++ b/pkgs/development/python-modules/langchain-text-splitters/default.nix @@ -33,6 +33,10 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_text_splitters" ]; + passthru = { + inherit (langchain-core) updateScript; + }; + meta = with lib; { description = "Build context-aware reasoning applications"; homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/text-splitters"; diff --git a/pkgs/development/python-modules/langchain/default.nix b/pkgs/development/python-modules/langchain/default.nix index 804f63a88e9f..7b085b2cde6f 100644 --- a/pkgs/development/python-modules/langchain/default.nix +++ b/pkgs/development/python-modules/langchain/default.nix @@ -166,6 +166,10 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain" ]; + passthru = { + updateScript = langchain-core.updateScript; + }; + meta = with lib; { description = "Building applications with LLMs through composability"; homepage = "https://github.com/langchain-ai/langchain"; From bcbfcb8a177cab0682f5cb3efd91e309a9bea7b4 Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 May 2024 01:32:31 +0000 Subject: [PATCH 2/5] python3Packages.langchain-core: 0.1.52 -> 0.2.1 Diff: https://github.com/langchain-ai/langchain/compare/langchain-core==0.1.52...langchain-core==0.2.1 --- .../python-modules/langchain-core/default.nix | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/langchain-core/default.nix b/pkgs/development/python-modules/langchain-core/default.nix index d2ee9ee504cf..cf919d3404da 100644 --- a/pkgs/development/python-modules/langchain-core/default.nix +++ b/pkgs/development/python-modules/langchain-core/default.nix @@ -1,34 +1,43 @@ { lib, - anyio, buildPythonPackage, - fetchPypi, + fetchFromGitHub, + freezegun, + grandalf, jsonpatch, langsmith, + numpy, packaging, poetry-core, pydantic, + pytest-asyncio, + pytest-mock, + pytest-xdist, + pytestCheckHook, pythonOlder, pythonRelaxDepsHook, pyyaml, - requests, + syrupy, tenacity, writeScript, }: buildPythonPackage rec { pname = "langchain-core"; - version = "0.1.52"; + version = "0.2.1"; pyproject = true; disabled = pythonOlder "3.8"; - src = fetchPypi { - pname = "langchain_core"; - inherit version; - hash = "sha256-CEw/xFL1ppZsKKs+xdvIuNJvw/YzeAc5KPTinZC2OT8="; + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langchain"; + rev = "langchain-core==${version}"; + hash = "sha256-D0y6kW5bWcCKW2TwVPlZcAUxqADgsOm9fWySAjHYYIg="; }; + sourceRoot = "${src.name}/libs/core"; + pythonRelaxDeps = [ "langsmith" "packaging" @@ -39,20 +48,28 @@ buildPythonPackage rec { nativeBuildInputs = [ pythonRelaxDepsHook ]; dependencies = [ - anyio jsonpatch langsmith packaging pydantic pyyaml - requests tenacity ]; pythonImportsCheck = [ "langchain_core" ]; - # PyPI source does not have tests - doCheck = false; + nativeCheckInputs = [ + freezegun + grandalf + numpy + pytest-asyncio + pytest-mock + pytest-xdist + pytestCheckHook + syrupy + ]; + + pytestFlagsArray = [ "tests/unit_tests" ]; passthru = { updateScript = writeScript "update.sh" '' @@ -70,6 +87,7 @@ buildPythonPackage rec { meta = with lib; { description = "Building applications with LLMs through composability"; homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/core"; + changelog = "https://github.com/langchain-ai/langchain/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ natsukium ]; }; From 5eba8fa86acf45c7c7791c9c74c246541433a7fd Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 May 2024 01:32:54 +0000 Subject: [PATCH 3/5] python3Packages.langchain: 0.1.52 -> 0.2.1 Diff: https://github.com/langchain-ai/langchain/compare/refs/tags/langchain==0.1.52...langchain==0.2.1 Changelog: https://github.com/langchain-ai/langchain/releases/tag/v0.2.1 --- .../development/python-modules/langchain/default.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/langchain/default.nix b/pkgs/development/python-modules/langchain/default.nix index 7b085b2cde6f..94dad83b0f31 100644 --- a/pkgs/development/python-modules/langchain/default.nix +++ b/pkgs/development/python-modules/langchain/default.nix @@ -10,13 +10,10 @@ chardet, clarifai, cohere, - dataclasses-json, esprima, fetchFromGitHub, freezegun, huggingface-hub, - jsonpatch, - langchain-community, langchain-core, langchain-text-splitters, langsmith, @@ -51,7 +48,7 @@ buildPythonPackage rec { pname = "langchain"; - version = "0.1.52"; + version = "0.2.1"; pyproject = true; disabled = pythonOlder "3.8"; @@ -59,8 +56,8 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "langchain-ai"; repo = "langchain"; - rev = "refs/tags/langchain-core==${version}"; - hash = "sha256-H8rtysRIwyuJEUFI93vid3MsqReyRCER88xztsuYpOc="; + rev = "refs/tags/langchain==${version}"; + hash = "sha256-cLJhdeft9XNLk5njSBaEBSuP31c2VFCJ1ET+ypo6mNY="; }; sourceRoot = "${src.name}/libs/langchain"; @@ -71,9 +68,6 @@ buildPythonPackage rec { dependencies = [ aiohttp - dataclasses-json - jsonpatch - langchain-community langchain-core langchain-text-splitters langsmith From daec3817ea3182ed7dcf0915bc40c558f3a234df Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 May 2024 01:33:13 +0000 Subject: [PATCH 4/5] python3Packages.langchain-community: 0.0.38 -> 0.2.1 Diff: https://github.com/langchain-ai/langchain/compare/langchain-community==0.0.38...langchain-community==0.2.1 --- .../langchain-community/default.nix | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/langchain-community/default.nix b/pkgs/development/python-modules/langchain-community/default.nix index 947d23fb21fd..684591f833eb 100644 --- a/pkgs/development/python-modules/langchain-community/default.nix +++ b/pkgs/development/python-modules/langchain-community/default.nix @@ -1,40 +1,55 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, poetry-core, pythonOlder, aiohttp, dataclasses-json, + duckdb-engine, + langchain, langchain-core, langsmith, + lark, numpy, + pandas, + pytest-asyncio, + pytest-mock, + pytestCheckHook, pyyaml, requests, + requests-mock, + responses, sqlalchemy, + syrupy, tenacity, + toml, typer, }: buildPythonPackage rec { pname = "langchain-community"; - version = "0.0.38"; + version = "0.2.1"; pyproject = true; disabled = pythonOlder "3.8"; - src = fetchPypi { - pname = "langchain_community"; - inherit version; - hash = "sha256-En/Et1vGe2L+gnxmwC5xWnMP74/mm9ICPUZrqwa1gQ0="; + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langchain"; + rev = "langchain-community==${version}"; + hash = "sha256-h8ZJiQYmyvzaRrEVNS7SamJTq4zY7J1IgYdQiVBFh4I="; }; + sourceRoot = "${src.name}/libs/community"; + build-system = [ poetry-core ]; dependencies = [ aiohttp dataclasses-json langchain-core + langchain langsmith numpy pyyaml @@ -49,8 +64,20 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_community" ]; - # PyPI source does not have tests - doCheck = false; + nativeCheckInputs = [ + duckdb-engine + lark + pandas + pytest-asyncio + pytest-mock + pytestCheckHook + requests-mock + responses + syrupy + toml + ]; + + pytestFlagsArray = [ "tests/unit_tests" ]; passthru = { updateScript = langchain-core.updateScript; @@ -59,6 +86,7 @@ buildPythonPackage rec { meta = with lib; { description = "Community contributed LangChain integrations"; homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/community"; + changelog = "https://github.com/langchain-ai/langchain/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ natsukium ]; }; From 3f5b5e6ee65a2f122aa0ca74b0eb02c65c525d2c Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 May 2024 02:24:26 +0000 Subject: [PATCH 5/5] python3Packages.langchain-text-splitters: 0.0.2 -> 0.2.0 Diff: https://github.com/langchain-ai/langchain/compare/refs/tags/langchain-text-splitters==0.0.2...langchain-text-splitters==0.2.0 --- .../langchain-text-splitters/default.nix | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/langchain-text-splitters/default.nix b/pkgs/development/python-modules/langchain-text-splitters/default.nix index 6084bbf5ee0b..73a1e722019a 100644 --- a/pkgs/development/python-modules/langchain-text-splitters/default.nix +++ b/pkgs/development/python-modules/langchain-text-splitters/default.nix @@ -1,38 +1,43 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, poetry-core, langchain-core, - lxml, + pytest-asyncio, + pytestCheckHook, pythonOlder, }: buildPythonPackage rec { pname = "langchain-text-splitters"; - version = "0.0.2"; + version = "0.2.0"; pyproject = true; disabled = pythonOlder "3.9"; - src = fetchPypi { - pname = "langchain_text_splitters"; - inherit version; - hash = "sha256-rIkn3AugjrpwL2lhye19986tjeGan3EBqyteo0IBs8E="; + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langchain"; + rev = "refs/tags/langchain-text-splitters==${version}"; + hash = "sha256-QrgZ0j/YdOgEgLeQNSKjOIwqdr/Izuw9Gh6eKQ/00tQ="; }; + sourceRoot = "${src.name}/libs/text-splitters"; + build-system = [ poetry-core ]; - dependencies = [ - langchain-core - lxml - ]; - - # PyPI source does not have tests - doCheck = false; + dependencies = [ langchain-core ]; pythonImportsCheck = [ "langchain_text_splitters" ]; + nativeCheckInputs = [ + pytest-asyncio + pytestCheckHook + ]; + + pytestFlagsArray = [ "tests/unit_tests" ]; + passthru = { inherit (langchain-core) updateScript; }; @@ -40,6 +45,7 @@ buildPythonPackage rec { meta = with lib; { description = "Build context-aware reasoning applications"; homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/text-splitters"; + changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.rev}"; license = licenses.mit; maintainers = with maintainers; [ fab ]; };