|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + buildPythonPackage, |
| 5 | + fetchFromGitHub, |
| 6 | + |
| 7 | + # build-system |
| 8 | + poetry-core, |
| 9 | + |
| 10 | + # dependencies |
| 11 | + langchain-core, |
| 12 | + langgraph-checkpoint, |
| 13 | + |
| 14 | + # tests |
| 15 | + langgraph-checkpoint-postgres, |
| 16 | + langgraph-checkpoint-sqlite, |
| 17 | + postgresql, |
| 18 | + postgresqlTestHook, |
| 19 | + psycopg-pool, |
| 20 | + psycopg, |
| 21 | + pytest-asyncio, |
| 22 | + pytest-mock, |
| 23 | + pytestCheckHook, |
| 24 | + |
| 25 | + # passthru |
| 26 | + nix-update-script, |
| 27 | +}: |
| 28 | +# langgraph-prebuilt isn't meant to be a standalone package but is bundled into langgraph at build time. |
| 29 | +# It exists so the langgraph team can iterate on it without having to rebuild langgraph. |
| 30 | +buildPythonPackage rec { |
| 31 | + pname = "langgraph-prebuilt"; |
| 32 | + version = "0.1.8"; |
| 33 | + pyproject = true; |
| 34 | + |
| 35 | + src = fetchFromGitHub { |
| 36 | + owner = "langchain-ai"; |
| 37 | + repo = "langgraph"; |
| 38 | + tag = "prebuilt==${version}"; |
| 39 | + hash = "sha256-mYcj7HRbB5H6G0CVLOICKgdtR5Wlv9WeTIBjQJqlhOE="; |
| 40 | + }; |
| 41 | + |
| 42 | + sourceRoot = "${src.name}/libs/prebuilt"; |
| 43 | + |
| 44 | + build-system = [ poetry-core ]; |
| 45 | + |
| 46 | + dependencies = [ |
| 47 | + langchain-core |
| 48 | + langgraph-checkpoint |
| 49 | + ]; |
| 50 | + |
| 51 | + skipPythonImportsCheck = true; # This will be packaged with langgraph |
| 52 | + |
| 53 | + # postgresql doesn't play nicely with the darwin sandbox: |
| 54 | + # FATAL: could not create shared memory segment: Operation not permitted |
| 55 | + doCheck = !stdenv.hostPlatform.isDarwin; |
| 56 | + |
| 57 | + nativeCheckInputs = [ |
| 58 | + pytestCheckHook |
| 59 | + postgresql |
| 60 | + postgresqlTestHook |
| 61 | + ]; |
| 62 | + |
| 63 | + checkInputs = [ |
| 64 | + langgraph-checkpoint |
| 65 | + langgraph-checkpoint-postgres |
| 66 | + langgraph-checkpoint-sqlite |
| 67 | + psycopg |
| 68 | + psycopg-pool |
| 69 | + pytest-asyncio |
| 70 | + pytest-mock |
| 71 | + ]; |
| 72 | + |
| 73 | + preCheck = '' |
| 74 | + export PYTHONPATH=${src}/libs/langgraph:$PYTHONPATH |
| 75 | + ''; |
| 76 | + |
| 77 | + pytestFlagsArray = [ |
| 78 | + "-W" |
| 79 | + "ignore::pytest.PytestDeprecationWarning" |
| 80 | + "-W" |
| 81 | + "ignore::DeprecationWarning" |
| 82 | + ]; |
| 83 | + |
| 84 | + disabledTestPaths = [ |
| 85 | + # psycopg.OperationalError: connection failed: connection to server at "127.0.0.1", port 5442 failed: Connection refused |
| 86 | + # Is the server running on that host and accepting TCP/IP connections? |
| 87 | + "tests/test_react_agent.py" |
| 88 | + ]; |
| 89 | + |
| 90 | + passthru.updateScript = nix-update-script { |
| 91 | + extraArgs = [ |
| 92 | + "--version-regex" |
| 93 | + "prebuilt==(\\d+\\.\\d+\\.\\d+)" |
| 94 | + ]; |
| 95 | + }; |
| 96 | + |
| 97 | + meta = { |
| 98 | + description = "Prebuilt agents add-on for Langgraph. Should always be bundled with langgraph"; |
| 99 | + homepage = "https://github.com/langchain-ai/langgraph"; |
| 100 | + changelog = "https://github.com/langchain-ai/langgraph/releases/tag/${version}"; |
| 101 | + license = lib.licenses.mit; |
| 102 | + maintainers = with lib.maintainers; [ sarahec ]; |
| 103 | + }; |
| 104 | +} |
0 commit comments