From 0808d2bb77368bab3ac8f44d694c88ae382a9341 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Sat, 15 Mar 2025 11:04:06 -0700 Subject: [PATCH] python3Packages.langchain*: define version regex in update script --- .../python-modules/langchain-aws/default.nix | 12 ++++++--- .../default.nix | 12 ++++++--- .../langchain-chroma/default.nix | 12 ++++++--- .../langchain-community/default.nix | 16 ++++++----- .../python-modules/langchain-core/default.nix | 27 +++++-------------- .../python-modules/langchain-groq/default.nix | 11 +++++--- .../langchain-huggingface/default.nix | 12 ++++++--- .../langchain-mongodb/default.nix | 12 ++++++--- .../langchain-openai/default.nix | 12 ++++++--- .../langchain-tests/default.nix | 10 +++++++ .../langchain-text-splitters/default.nix | 12 ++++++--- .../python-modules/langchain/default.nix | 12 ++++++--- 12 files changed, 99 insertions(+), 61 deletions(-) diff --git a/pkgs/development/python-modules/langchain-aws/default.nix b/pkgs/development/python-modules/langchain-aws/default.nix index 3fcf0d9deaa2..d3f998ee2963 100644 --- a/pkgs/development/python-modules/langchain-aws/default.nix +++ b/pkgs/development/python-modules/langchain-aws/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system poetry-core, @@ -64,11 +65,14 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_aws" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-aws==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { changelog = "https://github.com/langchain-ai/langchain-aws/releases/tag/v${version}"; 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 d38b2c604000..c507d23e3c62 100644 --- a/pkgs/development/python-modules/langchain-azure-dynamic-sessions/default.nix +++ b/pkgs/development/python-modules/langchain-azure-dynamic-sessions/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system poetry-core, @@ -65,11 +66,14 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_azure_dynamic_sessions" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-azure-dynamic-sessions==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { description = "Integration package connecting Azure Container Apps dynamic sessions and LangChain"; diff --git a/pkgs/development/python-modules/langchain-chroma/default.nix b/pkgs/development/python-modules/langchain-chroma/default.nix index f074d7f3f53a..76c72230c089 100644 --- a/pkgs/development/python-modules/langchain-chroma/default.nix +++ b/pkgs/development/python-modules/langchain-chroma/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, chromadb, langchain-core, langchain-tests, @@ -50,11 +51,14 @@ buildPythonPackage rec { "test_chroma_update_document" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-chroma==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-chroma==${version}"; diff --git a/pkgs/development/python-modules/langchain-community/default.nix b/pkgs/development/python-modules/langchain-community/default.nix index 97bb3c06e8d4..3b598546128e 100644 --- a/pkgs/development/python-modules/langchain-community/default.nix +++ b/pkgs/development/python-modules/langchain-community/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system pdm-backend, @@ -98,12 +99,6 @@ buildPythonPackage rec { pytestFlagsArray = [ "tests/unit_tests" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; - }; - __darwinAllowLocalNetworking = true; disabledTests = [ @@ -124,6 +119,15 @@ buildPythonPackage rec { "test_group_dependencies" ]; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-community==([0-9.]+)$" + ]; + }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; + meta = { changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-community==${version}"; description = "Community contributed LangChain integrations"; diff --git a/pkgs/development/python-modules/langchain-core/default.nix b/pkgs/development/python-modules/langchain-core/default.nix index d6d4ccd1deac..4d27601e12b0 100644 --- a/pkgs/development/python-modules/langchain-core/default.nix +++ b/pkgs/development/python-modules/langchain-core/default.nix @@ -30,7 +30,7 @@ syrupy, # passthru - writeScript, + nix-update-script, }: buildPythonPackage rec { @@ -94,26 +94,13 @@ buildPythonPackage rec { tests.pytest = langchain-core.overridePythonAttrs (_: { doCheck = true; }); - # 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 - ''; + updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-core==([0-9.]+)$" + ]; + }; # updates the wrong fetcher rev attribute skipBulkUpdate = true; }; diff --git a/pkgs/development/python-modules/langchain-groq/default.nix b/pkgs/development/python-modules/langchain-groq/default.nix index fbcb402b174a..5a62185b0f73 100644 --- a/pkgs/development/python-modules/langchain-groq/default.nix +++ b/pkgs/development/python-modules/langchain-groq/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system pdm-backend, @@ -47,10 +48,14 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_groq" ]; - passthru = { - inherit (langchain-core) updateScript; - skipBulkUpdate = true; # Broken, see https://github.com/NixOS/nixpkgs/issues/379898 + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-groq==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-groq==${version}"; diff --git a/pkgs/development/python-modules/langchain-huggingface/default.nix b/pkgs/development/python-modules/langchain-huggingface/default.nix index 1ed4271ad784..c88eb502085e 100644 --- a/pkgs/development/python-modules/langchain-huggingface/default.nix +++ b/pkgs/development/python-modules/langchain-huggingface/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system poetry-core, @@ -71,11 +72,14 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_huggingface" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-huggingface==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-huggingface==${version}"; diff --git a/pkgs/development/python-modules/langchain-mongodb/default.nix b/pkgs/development/python-modules/langchain-mongodb/default.nix index dbe90af0c79d..a8356221aabe 100644 --- a/pkgs/development/python-modules/langchain-mongodb/default.nix +++ b/pkgs/development/python-modules/langchain-mongodb/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system poetry-core, @@ -60,11 +61,14 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_mongodb" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-mongodb==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-mongodb==${version}"; diff --git a/pkgs/development/python-modules/langchain-openai/default.nix b/pkgs/development/python-modules/langchain-openai/default.nix index 486894b6d142..f126f6b4a87a 100644 --- a/pkgs/development/python-modules/langchain-openai/default.nix +++ b/pkgs/development/python-modules/langchain-openai/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system pdm-backend, @@ -89,11 +90,14 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain_openai" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-openai==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-openai==${version}"; diff --git a/pkgs/development/python-modules/langchain-tests/default.nix b/pkgs/development/python-modules/langchain-tests/default.nix index 8f1b87e3f494..dfb53f3a78aa 100644 --- a/pkgs/development/python-modules/langchain-tests/default.nix +++ b/pkgs/development/python-modules/langchain-tests/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system pdm-backend, @@ -54,6 +55,15 @@ buildPythonPackage rec { pytestCheckHook ]; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-tests==([0-9.]+)$" + ]; + }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; + meta = { description = "Build context-aware reasoning applications"; homepage = "https://github.com/langchain-ai/langchain"; diff --git a/pkgs/development/python-modules/langchain-text-splitters/default.nix b/pkgs/development/python-modules/langchain-text-splitters/default.nix index 746c953d873b..cc9b83f69c13 100644 --- a/pkgs/development/python-modules/langchain-text-splitters/default.nix +++ b/pkgs/development/python-modules/langchain-text-splitters/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + nix-update-script, # build-system pdm-backend, @@ -43,11 +44,14 @@ buildPythonPackage rec { pytestFlagsArray = [ "tests/unit_tests" ]; - passthru = { - inherit (langchain-core) updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain-test-splitters==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-text-splitters==${version}"; diff --git a/pkgs/development/python-modules/langchain/default.nix b/pkgs/development/python-modules/langchain/default.nix index 779b84440936..df273af85d92 100644 --- a/pkgs/development/python-modules/langchain/default.nix +++ b/pkgs/development/python-modules/langchain/default.nix @@ -3,6 +3,7 @@ buildPythonPackage, fetchFromGitHub, pythonOlder, + nix-update-script, # build-system pdm-backend, @@ -144,11 +145,14 @@ buildPythonPackage rec { pythonImportsCheck = [ "langchain" ]; - passthru = { - updateScript = langchain-core.updateScript; - # updates the wrong fetcher rev attribute - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^langchain==([0-9.]+)$" + ]; }; + # updates the wrong fetcher rev attribute + passthru.skipBulkUpdate = true; meta = { description = "Building applications with LLMs through composability";