diff --git a/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix index b800f60141f1..ebd5eb24b6d0 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix @@ -2,28 +2,33 @@ lib, buildPythonPackage, fetchFromGitHub, + stdenvNoCC, + + # build system + poetry-core, + + # dependencies langgraph-checkpoint, - langgraph-sdk, - orjson, + ormsgpack, psycopg, psycopg-pool, - poetry-core, - pythonOlder, + + # testing pgvector, postgresql, postgresqlTestHook, pytestCheckHook, pytest-asyncio, - stdenvNoCC, + + # passthru + nix-update-script, }: buildPythonPackage rec { pname = "langgraph-checkpoint-postgres"; - version = "2.0.15"; + version = "2.0.19"; pyproject = true; - disabled = pythonOlder "3.10"; - src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; @@ -43,7 +48,7 @@ buildPythonPackage rec { dependencies = [ langgraph-checkpoint - orjson + ormsgpack psycopg psycopg-pool ]; @@ -83,11 +88,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "langgraph.checkpoint.postgres" ]; - passthru = { - updateScript = langgraph-sdk.updateScript; - - # multiple tags confuse the bulk updater - skipBulkUpdate = true; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "checkpointpostgres==(\\d+\\.\\d+\\.\\d+)" + ]; }; meta = { diff --git a/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix b/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix index 7bd37f352d69..54efb25d7ca8 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix @@ -2,24 +2,32 @@ lib, buildPythonPackage, fetchFromGitHub, - langgraph-checkpoint, + + # build system + poetry-core, + + # dependencies aiosqlite, + langgraph-checkpoint, + + # testing pytest-asyncio, pytestCheckHook, - langgraph-sdk, - poetry-core, + + # passthru + nix-update-script, }: buildPythonPackage rec { pname = "langgraph-checkpoint-sqlite"; - version = "2.0.5"; + version = "2.0.6"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; tag = "checkpointsqlite==${version}"; - hash = "sha256-8JNPKaaKDM7VROd1n9TDALN6yxKRz1CuAultBcqBMG0="; + hash = "sha256-UUlrhQS0C2rPp//+LwU2rgR4R3AM5fM9X3CYvi/DAy8="; }; sourceRoot = "${src.name}/libs/checkpoint-sqlite"; @@ -45,9 +53,11 @@ buildPythonPackage rec { pytestCheckHook ]; - passthru = { - inherit (langgraph-sdk) updateScript; - skipBulkUpdate = true; # Broken, see https://github.com/NixOS/nixpkgs/issues/379898 + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "checkpoint-sqlite==(\\d+\\.\\d+\\.\\d+)" + ]; }; meta = { diff --git a/pkgs/development/python-modules/langgraph-checkpoint/default.nix b/pkgs/development/python-modules/langgraph-checkpoint/default.nix index 31b175ff1e9f..a6ead03a494d 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint/default.nix @@ -1,39 +1,49 @@ { lib, buildPythonPackage, - dataclasses-json, fetchFromGitHub, - langchain-core, - langgraph-sdk, - msgpack, + + # build system poetry-core, + + # dependencies + langchain-core, + msgpack, + ormsgpack, + + # testing + dataclasses-json, pytest-asyncio, pytest-mock, pytestCheckHook, + + # passthru + nix-update-script, }: buildPythonPackage rec { pname = "langgraph-checkpoint"; - version = "2.0.16"; + version = "2.0.24"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; tag = "checkpoint==${version}"; - hash = "sha256-HieCzNM+z7d0UGL8QOyjNP5P2IbLf0x0xhaUCWM/c0k="; + hash = "sha256-NlTpBXBeADlIHQDlt0muJEuoKOgXiAtAo8GoU5CsvZo="; }; sourceRoot = "${src.name}/libs/checkpoint"; build-system = [ poetry-core ]; - dependencies = [ langchain-core ]; + dependencies = [ + langchain-core + ormsgpack + ]; propagatedBuildInputs = [ msgpack ]; - pythonRelaxDeps = [ "msgpack" ]; # Can drop after msgpack 1.0.10 lands in nixpkgs - pythonImportsCheck = [ "langgraph.checkpoint" ]; nativeCheckInputs = [ @@ -48,9 +58,11 @@ buildPythonPackage rec { "test_serde_jsonplus" ]; - passthru = { - updateScript = langgraph-sdk.updateScript; - skipBulkUpdate = true; # Broken, see https://github.com/NixOS/nixpkgs/issues/379898 + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "checkpoint==(\\d+\\.\\d+\\.\\d+)" + ]; }; meta = { diff --git a/pkgs/development/python-modules/langgraph-cli/default.nix b/pkgs/development/python-modules/langgraph-cli/default.nix index 9403d86784db..4b4cddcb998a 100644 --- a/pkgs/development/python-modules/langgraph-cli/default.nix +++ b/pkgs/development/python-modules/langgraph-cli/default.nix @@ -1,33 +1,33 @@ { lib, buildPythonPackage, - click, fetchFromGitHub, + + # build-system poetry-core, - # for update script - langgraph-sdk, + # dependencies + click, # testing pytest-asyncio, pytestCheckHook, docker-compose, - pythonOlder, + # passthru + nix-update-script, }: buildPythonPackage rec { pname = "langgraph-cli"; - version = "0.1.74"; + version = "0.1.84"; pyproject = true; - disabled = pythonOlder "3.10"; - src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; tag = "cli==${version}"; - hash = "sha256-9/lL2TyOPiRIy6PfWEcd2fBNjn3n3Rpg0/7DL/4+Qpc="; + hash = "sha256-nb6u3YooDujRc6BKl35ZQPrKDlZkCreFn82TGxt4m5M="; }; sourceRoot = "${src.name}/libs/cli"; @@ -59,9 +59,11 @@ buildPythonPackage rec { "test_dockerfile_command_with_docker_compose" ]; - passthru = { - inherit (langgraph-sdk) updateScript; - skipBulkUpdate = true; # Broken, see https://github.com/NixOS/nixpkgs/issues/379898 + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "cli==(\\d+\\.\\d+\\.\\d+)" + ]; }; meta = { diff --git a/pkgs/development/python-modules/langgraph-prebuilt/default.nix b/pkgs/development/python-modules/langgraph-prebuilt/default.nix new file mode 100644 index 000000000000..73a1d6ade3ad --- /dev/null +++ b/pkgs/development/python-modules/langgraph-prebuilt/default.nix @@ -0,0 +1,104 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # build-system + poetry-core, + + # dependencies + langchain-core, + langgraph-checkpoint, + + # tests + langgraph-checkpoint-postgres, + langgraph-checkpoint-sqlite, + postgresql, + postgresqlTestHook, + psycopg-pool, + psycopg, + pytest-asyncio, + pytest-mock, + pytestCheckHook, + + # passthru + nix-update-script, +}: +# langgraph-prebuilt isn't meant to be a standalone package but is bundled into langgraph at build time. +# It exists so the langgraph team can iterate on it without having to rebuild langgraph. +buildPythonPackage rec { + pname = "langgraph-prebuilt"; + version = "0.1.8"; + pyproject = true; + + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langgraph"; + tag = "prebuilt==${version}"; + hash = "sha256-mYcj7HRbB5H6G0CVLOICKgdtR5Wlv9WeTIBjQJqlhOE="; + }; + + sourceRoot = "${src.name}/libs/prebuilt"; + + build-system = [ poetry-core ]; + + dependencies = [ + langchain-core + langgraph-checkpoint + ]; + + skipPythonImportsCheck = true; # This will be packaged with langgraph + + # postgresql doesn't play nicely with the darwin sandbox: + # FATAL: could not create shared memory segment: Operation not permitted + doCheck = !stdenv.hostPlatform.isDarwin; + + nativeCheckInputs = [ + pytestCheckHook + postgresql + postgresqlTestHook + ]; + + checkInputs = [ + langgraph-checkpoint + langgraph-checkpoint-postgres + langgraph-checkpoint-sqlite + psycopg + psycopg-pool + pytest-asyncio + pytest-mock + ]; + + preCheck = '' + export PYTHONPATH=${src}/libs/langgraph:$PYTHONPATH + ''; + + pytestFlagsArray = [ + "-W" + "ignore::pytest.PytestDeprecationWarning" + "-W" + "ignore::DeprecationWarning" + ]; + + disabledTestPaths = [ + # psycopg.OperationalError: connection failed: connection to server at "127.0.0.1", port 5442 failed: Connection refused + # Is the server running on that host and accepting TCP/IP connections? + "tests/test_react_agent.py" + ]; + + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "prebuilt==(\\d+\\.\\d+\\.\\d+)" + ]; + }; + + meta = { + description = "Prebuilt agents add-on for Langgraph. Should always be bundled with langgraph"; + homepage = "https://github.com/langchain-ai/langgraph"; + changelog = "https://github.com/langchain-ai/langgraph/releases/tag/${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ sarahec ]; + }; +} diff --git a/pkgs/development/python-modules/langgraph-sdk/default.nix b/pkgs/development/python-modules/langgraph-sdk/default.nix index ab0c5fbb4340..563e0babce35 100644 --- a/pkgs/development/python-modules/langgraph-sdk/default.nix +++ b/pkgs/development/python-modules/langgraph-sdk/default.nix @@ -13,19 +13,19 @@ typing-extensions, # passthru - writeScript, + nix-update-script, }: buildPythonPackage rec { pname = "langgraph-sdk"; - version = "0.1.53"; + version = "0.1.61"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; tag = "sdk==${version}"; - hash = "sha256-Mx/36+FYZi/XNHJwlNRKE/lVo6nRTXUQwtYkq7HmBu0="; + hash = "sha256-cwoJ/1D+oAxqt6DEmpRBxDiR2nRAqBIOfqwLOmgUcZQ="; }; sourceRoot = "${src.name}/libs/sdk-py"; @@ -43,20 +43,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "langgraph_sdk" ]; - passthru = { - updateScript = writeScript "update.sh" '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p nix-update - - set -eu -o pipefail +e - nix-update --commit --version-regex '(.*)' python3Packages.langgraph - nix-update --commit --version-regex 'sdk==(.*)' python3Packages.langgraph-sdk - nix-update --commit --version-regex 'checkpoint==(.*)' python3Packages.langgraph-checkpoint - nix-update --commit --version-regex 'checkpointduckdb==(.*)' python3Packages.langgraph-checkpoint-duckdb - nix-update --commit --version-regex 'checkpointpostgres==(.*)' python3Packages.langgraph-checkpoint-postgres - nix-update --commit --version-regex 'checkpointsqlite==(.*)' python3Packages.langgraph-checkpoint-sqlite - ''; - skipBulkUpdate = true; # Broken, see https://github.com/NixOS/nixpkgs/issues/379898 + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "sdk==(\\d+\\.\\d+\\.\\d+)" + ]; }; meta = { diff --git a/pkgs/development/python-modules/langgraph/default.nix b/pkgs/development/python-modules/langgraph/default.nix index 855d854f3d8c..2716824e6d71 100644 --- a/pkgs/development/python-modules/langgraph/default.nix +++ b/pkgs/development/python-modules/langgraph/default.nix @@ -10,7 +10,9 @@ # dependencies langchain-core, langgraph-checkpoint, + langgraph-prebuilt, langgraph-sdk, + xxhash, # tests aiosqlite, @@ -32,80 +34,16 @@ postgresql, postgresqlTestHook, }: -let - # langgraph-prebuilt isn't meant to be a standalone package but is bundled into langgraph at build time. - # It exists so the langgraph team can iterate on it without having to rebuild langgraph. - langgraph-prebuilt = buildPythonPackage rec { - pname = "langgraph-prebuilt"; - version = "0.1.1"; - pyproject = true; - - src = fetchFromGitHub { - owner = "langchain-ai"; - repo = "langgraph"; - tag = "prebuilt==${version}"; - hash = "sha256-Kyyr4BSrUReC6jBp4LItuS/JNSzGK5IUaPl7UaLse78="; - }; - - sourceRoot = "${src.name}/libs/prebuilt"; - - build-system = [ poetry-core ]; - - dependencies = [ - langchain-core - langgraph-checkpoint - ]; - - skipPythonImportsCheck = true; # This will be packaged with langgraph - - # postgresql doesn't play nicely with the darwin sandbox: - # FATAL: could not create shared memory segment: Operation not permitted - doCheck = !stdenv.hostPlatform.isDarwin; - - nativeCheckInputs = [ - pytestCheckHook - postgresql - postgresqlTestHook - ]; - - checkInputs = [ - langgraph-checkpoint - langgraph-checkpoint-postgres - langgraph-checkpoint-sqlite - psycopg - psycopg-pool - pytest-asyncio - pytest-mock - ]; - - preCheck = '' - export PYTHONPATH=${src}/libs/langgraph:$PYTHONPATH - ''; - - pytestFlagsArray = [ - "-W" - "ignore::pytest.PytestDeprecationWarning" - "-W" - "ignore::DeprecationWarning" - ]; - - disabledTestPaths = [ - # psycopg.OperationalError: connection failed: connection to server at "127.0.0.1", port 5442 failed: Connection refused - # Is the server running on that host and accepting TCP/IP connections? - "tests/test_react_agent.py" - ]; - }; -in buildPythonPackage rec { pname = "langgraph"; - version = "0.3.2"; + version = "0.3.24"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; tag = "${version}"; - hash = "sha256-EawVIzG+db2k6/tQyUHCF6SzlO77QTXsYRUm3XpLu/c="; + hash = "sha256-NlTpBXBeADlIHQDlt0muJEuoKOgXiAtAo8GoU5CsvZo="; }; postgresqlTestSetupPost = '' @@ -122,6 +60,7 @@ buildPythonPackage rec { langgraph-checkpoint langgraph-prebuilt langgraph-sdk + xxhash ]; pythonImportsCheck = [ "langgraph" ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 52e13fe1c143..ce39b08da1c1 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7474,6 +7474,8 @@ self: super: with self; { langgraph-cli = callPackage ../development/python-modules/langgraph-cli { }; + langgraph-prebuilt = callPackage ../development/python-modules/langgraph-prebuilt { }; + langgraph-sdk = callPackage ../development/python-modules/langgraph-sdk { }; langid = callPackage ../development/python-modules/langid { };