From 09ba7e257a79a9343223f17b207c905b44b8c5d3 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Tue, 18 Mar 2025 16:14:35 -0700 Subject: [PATCH 1/7] python3Packages.langgraph*: define version regex in update script --- .../langgraph-checkpoint-postgres/default.nix | 27 +++++++++++-------- .../langgraph-checkpoint-sqlite/default.nix | 22 ++++++++++----- .../langgraph-checkpoint/default.nix | 24 ++++++++++++----- .../python-modules/langgraph-cli/default.nix | 20 +++++++------- .../python-modules/langgraph-sdk/default.nix | 21 +++++---------- 5 files changed, 66 insertions(+), 48 deletions(-) diff --git a/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix index b800f60141f1..1a79d08a275e 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix @@ -2,19 +2,26 @@ lib, buildPythonPackage, fetchFromGitHub, + stdenvNoCC, + + # build system + poetry-core, + + # dependencies langgraph-checkpoint, - langgraph-sdk, orjson, psycopg, psycopg-pool, - poetry-core, - pythonOlder, + + # testing pgvector, postgresql, postgresqlTestHook, pytestCheckHook, pytest-asyncio, - stdenvNoCC, + + # passthru + nix-update-script, }: buildPythonPackage rec { @@ -22,8 +29,6 @@ buildPythonPackage rec { version = "2.0.15"; pyproject = true; - disabled = pythonOlder "3.10"; - src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; @@ -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..7255c4aefa38 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix @@ -2,12 +2,20 @@ 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 { @@ -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..e2a9e47b6244 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint/default.nix @@ -1,15 +1,23 @@ { lib, buildPythonPackage, - dataclasses-json, fetchFromGitHub, - langchain-core, - langgraph-sdk, - msgpack, + + # build system poetry-core, + + # dependencies + langchain-core, + msgpack, + + # testing + dataclasses-json, pytest-asyncio, pytest-mock, pytestCheckHook, + + # passthru + nix-update-script, }: buildPythonPackage rec { @@ -48,9 +56,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..709bf4d378ab 100644 --- a/pkgs/development/python-modules/langgraph-cli/default.nix +++ b/pkgs/development/python-modules/langgraph-cli/default.nix @@ -1,19 +1,21 @@ { 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 { @@ -21,8 +23,6 @@ buildPythonPackage rec { version = "0.1.74"; pyproject = true; - disabled = pythonOlder "3.10"; - src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; @@ -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-sdk/default.nix b/pkgs/development/python-modules/langgraph-sdk/default.nix index ab0c5fbb4340..932121757ab3 100644 --- a/pkgs/development/python-modules/langgraph-sdk/default.nix +++ b/pkgs/development/python-modules/langgraph-sdk/default.nix @@ -13,7 +13,7 @@ typing-extensions, # passthru - writeScript, + nix-update-script, }: buildPythonPackage rec { @@ -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 = { From d27ed9aaeaa1967d1e81e61b2cb80925027cfeb2 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Tue, 1 Apr 2025 12:34:54 -0700 Subject: [PATCH 2/7] python312Packages.{langgraph,langgraph-prebuilt}: unbundle prebuilt, update both --- .../langgraph-prebuilt/default.nix | 104 ++++++++++++++++++ .../python-modules/langgraph/default.nix | 71 +----------- pkgs/top-level/python-packages.nix | 2 + 3 files changed, 111 insertions(+), 66 deletions(-) create mode 100644 pkgs/development/python-modules/langgraph-prebuilt/default.nix 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/default.nix b/pkgs/development/python-modules/langgraph/default.nix index f99b92d1de14..8cd814b4af6d 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, @@ -33,80 +35,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 = '' @@ -123,6 +61,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 7270fd25d512..00c6bc450949 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7464,6 +7464,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 { }; From 350453b75fb110f2f24842cff739152dcbb9ec16 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Tue, 1 Apr 2025 13:14:07 -0700 Subject: [PATCH 3/7] python312Packages.langgraph-checkpoint: 2.0.16 -> 2.0.24 --- .../python-modules/langgraph-checkpoint/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/langgraph-checkpoint/default.nix b/pkgs/development/python-modules/langgraph-checkpoint/default.nix index e2a9e47b6244..a6ead03a494d 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint/default.nix @@ -9,6 +9,7 @@ # dependencies langchain-core, msgpack, + ormsgpack, # testing dataclasses-json, @@ -22,26 +23,27 @@ 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 = [ From 412cfc3ee3cf4d35dece232af7b9e0eef22daef1 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Tue, 1 Apr 2025 13:21:14 -0700 Subject: [PATCH 4/7] python312Packages.langgraph-checkpoint-postgres: 2.0.15->2.0.19 --- .../langgraph-checkpoint-postgres/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix index 1a79d08a275e..ebd5eb24b6d0 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix @@ -9,7 +9,7 @@ # dependencies langgraph-checkpoint, - orjson, + ormsgpack, psycopg, psycopg-pool, @@ -26,7 +26,7 @@ buildPythonPackage rec { pname = "langgraph-checkpoint-postgres"; - version = "2.0.15"; + version = "2.0.19"; pyproject = true; src = fetchFromGitHub { @@ -48,7 +48,7 @@ buildPythonPackage rec { dependencies = [ langgraph-checkpoint - orjson + ormsgpack psycopg psycopg-pool ]; From c74a6fd6bfa3e6a130f1db0071a4e77f36e4c1e3 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Tue, 1 Apr 2025 18:01:23 -0700 Subject: [PATCH 5/7] python312Packages.langgraph-checkpoint-sqlite: 2.0.5 -> 2.0.6 --- .../python-modules/langgraph-checkpoint-sqlite/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix b/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix index 7255c4aefa38..54efb25d7ca8 100644 --- a/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix +++ b/pkgs/development/python-modules/langgraph-checkpoint-sqlite/default.nix @@ -20,14 +20,14 @@ 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"; From ca9eeaccd30f6049d115d493204ac8acb75de99d Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Tue, 1 Apr 2025 18:16:11 -0700 Subject: [PATCH 6/7] python312Packages.langgraph-cli: 0.1.74 -> 0.1.84 --- pkgs/development/python-modules/langgraph-cli/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/langgraph-cli/default.nix b/pkgs/development/python-modules/langgraph-cli/default.nix index 709bf4d378ab..4b4cddcb998a 100644 --- a/pkgs/development/python-modules/langgraph-cli/default.nix +++ b/pkgs/development/python-modules/langgraph-cli/default.nix @@ -20,14 +20,14 @@ buildPythonPackage rec { pname = "langgraph-cli"; - version = "0.1.74"; + version = "0.1.84"; pyproject = true; 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"; From b4bbe42f0d10889f74ae4890ff68abfa7f8a0aec Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Wed, 2 Apr 2025 13:40:36 -0700 Subject: [PATCH 7/7] python312Packages.langgraph-sdk: 0.1.53 -> 0.1.61 --- pkgs/development/python-modules/langgraph-sdk/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/langgraph-sdk/default.nix b/pkgs/development/python-modules/langgraph-sdk/default.nix index 932121757ab3..563e0babce35 100644 --- a/pkgs/development/python-modules/langgraph-sdk/default.nix +++ b/pkgs/development/python-modules/langgraph-sdk/default.nix @@ -18,14 +18,14 @@ 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";