1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
8
9 # dependencies
10 click,
11 langgraph,
12 langgraph-runtime-inmem,
13 langgraph-sdk,
14 python-dotenv,
15
16 # testing
17 pytest-asyncio,
18 pytestCheckHook,
19 docker-compose,
20
21 # passthru
22 gitUpdater,
23}:
24
25buildPythonPackage rec {
26 pname = "langgraph-cli";
27 version = "0.4.2";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "langchain-ai";
32 repo = "langgraph";
33 tag = "cli==${version}";
34 hash = "sha256-me9Qn7wwDsls419LOoRnYgIgmCblqLEFwNdH3I/tv0U=";
35 };
36
37 sourceRoot = "${src.name}/libs/cli";
38
39 build-system = [ hatchling ];
40
41 dependencies = [
42 click
43 langgraph-sdk
44 ];
45
46 optional-dependencies = {
47 "inmem" = [
48 langgraph
49 langgraph-runtime-inmem
50 python-dotenv
51 ];
52 };
53
54 nativeCheckInputs = [
55 pytest-asyncio
56 pytestCheckHook
57 docker-compose
58 ]
59 ++ lib.flatten (builtins.attrValues optional-dependencies);
60
61 enabledTestPaths = [ "tests/unit_tests" ];
62
63 pythonImportsCheck = [ "langgraph_cli" ];
64
65 disabledTests = [
66 # Flaky tests that generate a Docker configuration then compare to exact text
67 "test_config_to_docker_simple"
68 "test_config_to_docker_pipconfig"
69 "test_config_to_compose_env_vars"
70 "test_config_to_compose_env_file"
71 "test_config_to_compose_end_to_end"
72 "test_config_to_compose_simple_config"
73 "test_config_to_compose_watch"
74
75 # Tests that require docker
76 "test_dockerfile_command_with_docker_compose"
77 "test_build_command_with_api_version_and_base_image"
78 "test_build_command_with_api_version"
79 "test_build_generate_proper_build_context"
80 "test_build_command_shows_wolfi_warning"
81 ];
82
83 passthru = {
84 # python updater script sets the wrong tag
85 skipBulkUpdate = true;
86 updateScript = gitUpdater {
87 rev-prefix = "cli==";
88 };
89 };
90
91 meta = {
92 description = "Official CLI for LangGraph API";
93 homepage = "https://github.com/langchain-ai/langgraph/tree/main/libs/cli";
94 changelog = "https://github.com/langchain-ai/langgraph/releases/tag/${src.tag}";
95 mainProgram = "langgraph";
96 license = lib.licenses.mit;
97 maintainers = with lib.maintainers; [ sarahec ];
98 };
99}