about summary refs log tree commit diff
path: root/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix
blob: adcd0856f027fd83bf87baace7eb035dc8b5a8ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  langgraph-checkpoint,
  orjson,
  psycopg,
  psycopg-pool,
  langgraph-sdk,
  poetry-core,
  pythonOlder,
  postgresql,
  postgresqlTestHook,
  pytestCheckHook,
  pytest-asyncio,
  stdenvNoCC,
}:

buildPythonPackage rec {
  pname = "langgraph-checkpoint-postgres";
  version = "1.0.6";
  pyproject = true;

  disabled = pythonOlder "3.10";

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langgraph";
    rev = "refs/tags/checkpointpostgres==${version}";
    hash = "sha256-F9sgZQQBFs5hDUsaR5BI9ERve9L8LTUvEKOgyz5ioqY=";
  };

  postgresqlTestSetupPost = ''
    substituteInPlace tests/conftest.py \
      --replace-fail "DEFAULT_URI = \"postgres://postgres:postgres@localhost:5441/postgres?sslmode=disable\"" "DEFAULT_URI = \"postgres:///$PGDATABASE\""
  '';

  sourceRoot = "${src.name}/libs/checkpoint-postgres";

  build-system = [ poetry-core ];

  dependencies = [
    langgraph-checkpoint
    orjson
    psycopg
    psycopg-pool
  ];

  pythonRelaxDeps = [ "psycopg-pool" ];

  doCheck = !(stdenvNoCC.isDarwin);

  pythonImportsCheck = [ "langgraph.checkpoint.postgres" ];

  nativeCheckInputs = [
    postgresql
    postgresqlTestHook
    pytest-asyncio
    pytestCheckHook
  ];

  passthru = {
    updateScript = langgraph-sdk.updateScript;
  };

  meta = {
    description = "Library with a Postgres implementation of LangGraph checkpoint saver";
    homepage = "https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint-postgres";
    changelog = "https://github.com/langchain-ai/langgraph/releases/tag/checkpointpostgres==${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      drupol
      sarahec
    ];
  };
}