diff --git a/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix new file mode 100644 index 000000000000..a3e9d63d6213 --- /dev/null +++ b/pkgs/development/python-modules/langgraph-checkpoint-postgres/default.nix @@ -0,0 +1,69 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + langgraph-checkpoint, + orjson, + psycopg, + langgraph-sdk, + poetry-core, + pythonOlder, + postgresql, + postgresqlTestHook, + pytestCheckHook, + pytest-asyncio, +}: + +buildPythonPackage rec { + pname = "langgraph-checkpoint-postgres"; + version = "1.0.3"; + pyproject = true; + + disabled = pythonOlder "3.10"; + + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langgraph"; + rev = "refs/tags/checkpointpostgres==${version}"; + hash = "sha256-U7Bymo+Nj82kwjxN33W2MT10jv+lioZUxIKUt8Yxh/s="; + }; + + 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 + ]; + + 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 + ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e237b7703fae..9a9f3e0e5550 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6766,6 +6766,8 @@ self: super: with self; { langgraph = callPackage ../development/python-modules/langgraph { }; + langgraph-checkpoint-postgres = callPackage ../development/python-modules/langgraph-checkpoint-postgres { }; + langgraph-checkpoint-sqlite = callPackage ../development/python-modules/langgraph-checkpoint-sqlite { }; langgraph-cli = callPackage ../development/python-modules/langgraph-cli { };