Skip to content

Commit

Permalink
python3Packages.langchain*: Move dependencies of langchain-core to a …
Browse files Browse the repository at this point in the history
…common update script
  • Loading branch information
sarahec committed Sep 20, 2024
1 parent 2083a7f commit 1b414a4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 35 deletions.
4 changes: 4 additions & 0 deletions pkgs/development/python-modules/langchain-aws/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
responses,
syrupy,
toml,

nix-update-script,
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -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 = {
Expand Down
8 changes: 2 additions & 6 deletions pkgs/development/python-modules/langchain-chroma/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
numpy,
poetry-core,
pytestCheckHook,
nix-update-script,
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -38,11 +37,8 @@ buildPythonPackage rec {

nativeCheckInputs = [ pytestCheckHook ];

passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"langchain-chroma==(.*)"
];
passthru = {
inherit (langchain-core) updateScript;
};

meta = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ buildPythonPackage rec {
pytestFlagsArray = [ "tests/unit_tests" ];

passthru = {
updateScript = langchain-core.updateScript;
inherit (langchain-core) updateScript;
};

__darwinAllowLocalNetworking = true;
Expand Down
10 changes: 10 additions & 0 deletions pkgs/development/python-modules/langchain-core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
responses,
syrupy,
toml,

nix-update-script,
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -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 = {
Expand Down
9 changes: 2 additions & 7 deletions pkgs/development/python-modules/langchain-mongodb/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
pytestCheckHook,
pytest-mock,
syrupy,

nix-update-script,
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -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 = {
Expand Down
9 changes: 2 additions & 7 deletions pkgs/development/python-modules/langchain-openai/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
responses,
syrupy,
toml,

nix-update-script,
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 1b414a4

Please sign in to comment.