2024-07-27 06:49:29 +00:00
|
|
|
{
|
|
|
|
lib,
|
2024-09-19 14:19:46 +00:00
|
|
|
stdenv,
|
2024-07-27 06:49:29 +00:00
|
|
|
buildPythonPackage,
|
2024-09-19 14:19:46 +00:00
|
|
|
fetchFromGitHub,
|
|
|
|
|
|
|
|
# build-system
|
|
|
|
poetry-core,
|
|
|
|
|
|
|
|
# dependencies
|
|
|
|
langchain-core,
|
|
|
|
langgraph-checkpoint,
|
|
|
|
|
|
|
|
# tests
|
2024-07-27 06:49:29 +00:00
|
|
|
aiosqlite,
|
|
|
|
dataclasses-json,
|
|
|
|
grandalf,
|
|
|
|
httpx,
|
2024-09-19 14:19:46 +00:00
|
|
|
langgraph-checkpoint-postgres,
|
|
|
|
langgraph-checkpoint-sqlite,
|
2024-07-27 06:49:29 +00:00
|
|
|
langsmith,
|
2024-09-19 14:19:46 +00:00
|
|
|
psycopg,
|
2024-07-27 06:49:29 +00:00
|
|
|
pydantic,
|
|
|
|
pytest-asyncio,
|
|
|
|
pytest-mock,
|
2024-09-19 14:19:46 +00:00
|
|
|
pytest-repeat,
|
2024-07-27 06:49:29 +00:00
|
|
|
pytest-xdist,
|
|
|
|
pytestCheckHook,
|
|
|
|
syrupy,
|
2024-09-19 14:19:46 +00:00
|
|
|
postgresql,
|
|
|
|
postgresqlTestHook,
|
|
|
|
|
|
|
|
# passthru
|
|
|
|
langgraph-sdk,
|
2024-07-27 06:49:29 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "langgraph";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.2.21";
|
2024-07-27 06:49:29 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "langchain-ai";
|
|
|
|
repo = "langgraph";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-1Ch2V85omAKnXK9rMihNtyjIoOvmVUm8Dbdo5GBoik4=";
|
2024-07-27 06:49:29 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
postgresqlTestSetupPost = ''
|
|
|
|
substituteInPlace tests/conftest.py \
|
|
|
|
--replace-fail "DEFAULT_POSTGRES_URI = \"postgres://postgres:postgres@localhost:5442/\"" "DEFAULT_POSTGRES_URI = \"postgres:///$PGDATABASE\""
|
|
|
|
'';
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
sourceRoot = "${src.name}/libs/langgraph";
|
|
|
|
|
|
|
|
build-system = [ poetry-core ];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = [
|
|
|
|
langchain-core
|
|
|
|
langgraph-checkpoint
|
|
|
|
];
|
2024-07-27 06:49:29 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "langgraph" ];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
# postgresql doesn't play nicely with the darwin sandbox:
|
|
|
|
# FATAL: could not create shared memory segment: Operation not permitted
|
2024-09-26 11:04:55 +00:00
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
2024-09-19 14:19:46 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
aiosqlite
|
|
|
|
dataclasses-json
|
|
|
|
grandalf
|
|
|
|
httpx
|
2024-09-19 14:19:46 +00:00
|
|
|
langgraph-checkpoint-postgres
|
|
|
|
langgraph-checkpoint-sqlite
|
2024-07-27 06:49:29 +00:00
|
|
|
langsmith
|
2024-09-19 14:19:46 +00:00
|
|
|
psycopg
|
|
|
|
psycopg.pool
|
2024-07-27 06:49:29 +00:00
|
|
|
pydantic
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-mock
|
2024-09-19 14:19:46 +00:00
|
|
|
pytest-repeat
|
2024-07-27 06:49:29 +00:00
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
syrupy
|
2024-09-19 14:19:46 +00:00
|
|
|
postgresql
|
|
|
|
postgresqlTestHook
|
2024-07-27 06:49:29 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
"test_doesnt_warn_valid_schema" # test is flaky due to pydantic error on the exception
|
2024-09-19 14:19:46 +00:00
|
|
|
# Disabling tests that requires to create new random databases
|
|
|
|
"test_cancel_graph_astream"
|
|
|
|
"test_cancel_graph_astream_events_v2"
|
|
|
|
"test_channel_values"
|
|
|
|
"test_fork_always_re_runs_nodes"
|
|
|
|
"test_interruption_without_state_updates"
|
|
|
|
"test_interruption_without_state_updates_async"
|
|
|
|
"test_invoke_two_processes_in_out_interrupt"
|
|
|
|
"test_nested_graph_interrupts"
|
|
|
|
"test_no_modifier_async"
|
|
|
|
"test_no_modifier"
|
|
|
|
"test_pending_writes_resume"
|
|
|
|
"test_remove_message_via_state_update"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# psycopg.errors.InsufficientPrivilege: permission denied to create database
|
|
|
|
"tests/test_pregel_async.py"
|
|
|
|
"tests/test_pregel.py"
|
2024-07-27 06:49:29 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = langgraph-sdk.updateScript;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Build resilient language agents as graphs";
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|