From 1b414a4a0be338d6d2cab1bf9a2934b44846c3fd Mon Sep 17 00:00:00 2001 From: sarahec Date: Sun, 15 Sep 2024 10:35:02 -0700 Subject: [PATCH] python3Packages.langchain*: Move dependencies of langchain-core to a common update script --- .../python-modules/langchain-aws/default.nix | 4 ++++ .../langchain-azure-dynamic-sessions/default.nix | 9 ++------- .../python-modules/langchain-chroma/default.nix | 8 ++------ .../python-modules/langchain-community/default.nix | 2 +- .../python-modules/langchain-core/default.nix | 10 ++++++++++ .../python-modules/langchain-huggingface/default.nix | 9 ++------- .../python-modules/langchain-mongodb/default.nix | 9 ++------- .../python-modules/langchain-openai/default.nix | 9 ++------- 8 files changed, 25 insertions(+), 35 deletions(-) diff --git a/pkgs/development/python-modules/langchain-aws/default.nix b/pkgs/development/python-modules/langchain-aws/default.nix index 83e063e9cc54c..767f2262c2870 100644 --- a/pkgs/development/python-modules/langchain-aws/default.nix +++ b/pkgs/development/python-modules/langchain-aws/default.nix @@ -55,6 +55,10 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_aws" ]; + passthru = { + inherit (langchain-core) updateScript; + }; + meta = { changelog = "https://github.com/langchain-ai/langchain-aws/releases/tag/v${version}"; description = "Build LangChain application on AWS"; diff --git a/pkgs/development/python-modules/langchain-azure-dynamic-sessions/default.nix b/pkgs/development/python-modules/langchain-azure-dynamic-sessions/default.nix index 0d9ce18648f69..9bf287ea2c341 100644 --- a/pkgs/development/python-modules/langchain-azure-dynamic-sessions/default.nix +++ b/pkgs/development/python-modules/langchain-azure-dynamic-sessions/default.nix @@ -23,8 +23,6 @@ responses, syrupy, toml, - - nix-update-script, }: buildPythonPackage rec { @@ -67,11 +65,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_azure_dynamic_sessions" ]; - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version-regex" - "langchain-azure-dynamic-sessions==(.*)" - ]; + passthru = { + inherit (langchain-core) updateScript; }; meta = { diff --git a/pkgs/development/python-modules/langchain-chroma/default.nix b/pkgs/development/python-modules/langchain-chroma/default.nix index d5a5a53ac90f4..f9a35e759c8e8 100644 --- a/pkgs/development/python-modules/langchain-chroma/default.nix +++ b/pkgs/development/python-modules/langchain-chroma/default.nix @@ -7,7 +7,6 @@ numpy, poetry-core, pytestCheckHook, - nix-update-script, }: buildPythonPackage rec { @@ -38,11 +37,8 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook ]; - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version-regex" - "langchain-chroma==(.*)" - ]; + passthru = { + inherit (langchain-core) updateScript; }; meta = { diff --git a/pkgs/development/python-modules/langchain-community/default.nix b/pkgs/development/python-modules/langchain-community/default.nix index 8f42413117ae0..54de5416be186 100644 --- a/pkgs/development/python-modules/langchain-community/default.nix +++ b/pkgs/development/python-modules/langchain-community/default.nix @@ -91,7 +91,7 @@ buildPythonPackage rec { pytestFlagsArray = [ "tests/unit_tests" ]; passthru = { - updateScript = langchain-core.updateScript; + inherit (langchain-core) updateScript; }; __darwinAllowLocalNetworking = true; diff --git a/pkgs/development/python-modules/langchain-core/default.nix b/pkgs/development/python-modules/langchain-core/default.nix index 0d835c4078c5e..1149c31f382ec 100644 --- a/pkgs/development/python-modules/langchain-core/default.nix +++ b/pkgs/development/python-modules/langchain-core/default.nix @@ -83,15 +83,25 @@ buildPythonPackage rec { ''; passthru = { + # Updates to core tend to drive updates in everything else updateScript = writeScript "update.sh" '' #!/usr/bin/env nix-shell #!nix-shell -i bash -p nix-update set -u -o pipefail +e + # Common core 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 + + # Extensions + nix-update --commit --version-regex 'langchain-aws==(.*)' python3Packages.langchain-aws + nix-update --commit --version-regex 'langchain-azure-dynamic-sessions==(.*)' python3Packages.langchain-azure-dynamic-sessions + nix-update --commit --version-regex 'langchain-chroma==(.*)' python3Packages.langchain-chroma + nix-update --commit --version-regex 'langchain-huggingface==(.*)' python3Packages.langchain-huggingface + nix-update --commit --version-regex 'langchain-mongodb==(.*)' python3Packages.langchain-mongodb + nix-update --commit --version-regex 'langchain-openai==(.*)' python3Packages.langchain-openai ''; }; diff --git a/pkgs/development/python-modules/langchain-huggingface/default.nix b/pkgs/development/python-modules/langchain-huggingface/default.nix index 51f201ea694fc..91866b4121128 100644 --- a/pkgs/development/python-modules/langchain-huggingface/default.nix +++ b/pkgs/development/python-modules/langchain-huggingface/default.nix @@ -26,8 +26,6 @@ responses, syrupy, toml, - - nix-update-script, }: buildPythonPackage rec { @@ -73,11 +71,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_huggingface" ]; - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version-regex" - "langchain-huggingface==(.*)" - ]; + passthru = { + inherit (langchain-core) updateScript; }; meta = { diff --git a/pkgs/development/python-modules/langchain-mongodb/default.nix b/pkgs/development/python-modules/langchain-mongodb/default.nix index cf99e1fdf16da..0a064621887c6 100644 --- a/pkgs/development/python-modules/langchain-mongodb/default.nix +++ b/pkgs/development/python-modules/langchain-mongodb/default.nix @@ -18,8 +18,6 @@ pytestCheckHook, pytest-mock, syrupy, - - nix-update-script, }: buildPythonPackage rec { @@ -58,11 +56,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_mongodb" ]; - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version-regex" - "langchain-mongodb==(.*)" - ]; + passthru = { + inherit (langchain-core) updateScript; }; meta = { diff --git a/pkgs/development/python-modules/langchain-openai/default.nix b/pkgs/development/python-modules/langchain-openai/default.nix index 1410e72aeac1b..82f0a776208a5 100644 --- a/pkgs/development/python-modules/langchain-openai/default.nix +++ b/pkgs/development/python-modules/langchain-openai/default.nix @@ -24,8 +24,6 @@ responses, syrupy, toml, - - nix-update-script, }: buildPythonPackage rec { @@ -89,11 +87,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_openai" ]; - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version-regex" - "langchain-openai==(.*)" - ]; + passthru = { + inherit (langchain-core) updateScript; }; meta = {