Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 langgraph-checkpoint, 6 langgraph-sdk, 7 orjson, 8 psycopg, 9 psycopg-pool, 10 poetry-core, 11 pythonOlder, 12 pgvector, 13 postgresql, 14 postgresqlTestHook, 15 pytestCheckHook, 16 pytest-asyncio, 17 stdenvNoCC, 18}: 19 20buildPythonPackage rec { 21 pname = "langgraph-checkpoint-postgres"; 22 version = "2.0.8"; 23 pyproject = true; 24 25 disabled = pythonOlder "3.10"; 26 27 src = fetchFromGitHub { 28 owner = "langchain-ai"; 29 repo = "langgraph"; 30 tag = "checkpointpostgres==${version}"; 31 hash = "sha256-yHLkFUp+q/XOt9Y9Dog2Tgs/K2CU7Bfkkucdr9vAKSg="; 32 }; 33 34 postgresqlTestSetupPost = '' 35 substituteInPlace tests/conftest.py \ 36 --replace-fail "DEFAULT_URI = \"postgres://postgres:postgres@localhost:5441/postgres?sslmode=disable\"" "DEFAULT_URI = \"postgres:///$PGDATABASE\"" \ 37 --replace-fail "DEFAULT_POSTGRES_URI = \"postgres://postgres:postgres@localhost:5441/\"" "DEFAULT_POSTGRES_URI = \"postgres:///\"" 38 ''; 39 40 sourceRoot = "${src.name}/libs/checkpoint-postgres"; 41 42 build-system = [ poetry-core ]; 43 44 dependencies = [ 45 langgraph-checkpoint 46 orjson 47 psycopg 48 psycopg-pool 49 ]; 50 51 pythonRelaxDeps = [ 52 "langgraph-checkpoint" 53 "psycopg-pool" 54 ]; 55 56 doCheck = !(stdenvNoCC.hostPlatform.isDarwin); 57 58 nativeCheckInputs = [ 59 pytest-asyncio 60 pytestCheckHook 61 (postgresql.withPackages (p: with p; [ pgvector ])) 62 postgresqlTestHook 63 ]; 64 65 preCheck = '' 66 export postgresqlTestUserOptions="LOGIN SUPERUSER" 67 ''; 68 69 disabledTests = [ 70 # psycopg.errors.FeatureNotSupported: extension "vector" is not available 71 # /nix/store/...postgresql-and-plugins-16.4/share/postgresql/extension/vector.control": No such file or directory. 72 "test_embed_with_path" 73 "test_embed_with_path_sync" 74 "test_scores" 75 "test_search_sorting" 76 "test_vector_store_initialization" 77 "test_vector_insert_with_auto_embedding" 78 "test_vector_update_with_embedding" 79 "test_vector_search_with_filters" 80 "test_vector_search_pagination" 81 "test_vector_search_edge_cases" 82 ]; 83 84 pythonImportsCheck = [ "langgraph.checkpoint.postgres" ]; 85 86 passthru = { 87 updateScript = langgraph-sdk.updateScript; 88 }; 89 90 meta = { 91 description = "Library with a Postgres implementation of LangGraph checkpoint saver"; 92 homepage = "https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint-postgres"; 93 changelog = "https://github.com/langchain-ai/langgraph/releases/tag/checkpointpostgres==${version}"; 94 license = lib.licenses.mit; 95 maintainers = with lib.maintainers; [ 96 drupol 97 sarahec 98 ]; 99 }; 100}