Unverified Commit 5de041e4 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python3Packages.langgraph*: fix `updateScript`, upgrade to latest (#396103)

parents 57cf30d5 b4bbe42f
Loading
Loading
Loading
Loading
+19 −14
Original line number Diff line number Diff line
@@ -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 = {
+18 −8
Original line number Diff line number Diff line
@@ -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 = {
+23 −11
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  dataclasses-json,
  fetchFromGitHub,

  # build system
  poetry-core,

  # dependencies
  langchain-core,
  langgraph-sdk,
  msgpack,
  poetry-core,
  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 = {
+13 −11
Original line number Diff line number Diff line
{
  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 = {
+104 −0
Original line number Diff line number Diff line
{
  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 ];
  };
}
Loading