From d06075cbcf6cc6e4dfd9e1742ad7222f5fc30d3a Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Fri, 11 Apr 2025 00:04:44 +0200 Subject: [PATCH] Fix new style config --- libs/cli/langgraph_cli/config.py | 6 +++++- libs/cli/tests/unit_tests/cli/test_cli.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/cli/langgraph_cli/config.py b/libs/cli/langgraph_cli/config.py index d934e75e1..b1b802bda 100644 --- a/libs/cli/langgraph_cli/config.py +++ b/libs/cli/langgraph_cli/config.py @@ -443,9 +443,13 @@ def _parse_node_version(version_str: str) -> int: ) from None -def _is_python_graph(spec: str) -> bool: +def _is_python_graph(spec: str | dict) -> bool: """Check if a graph is a Python graph based on the file extension.""" + # handle new style config + if isinstance(spec, dict): + spec = spec.get("path") + file_path = spec.split(":")[0] file_ext = os.path.splitext(file_path)[1] return file_ext in [".py", ".pyx", ".pyd", ".pyi"] diff --git a/libs/cli/tests/unit_tests/cli/test_cli.py b/libs/cli/tests/unit_tests/cli/test_cli.py index 4140ee9a5..8762448e6 100644 --- a/libs/cli/tests/unit_tests/cli/test_cli.py +++ b/libs/cli/tests/unit_tests/cli/test_cli.py @@ -178,8 +178,9 @@ def test_dockerfile_command_basic() -> None: """Test the 'dockerfile' command with basic configuration.""" runner = CliRunner() config_content = { - "node_version": "20", # Add any other necessary configuration fields + "python_version": "3.11", "graphs": {"agent": "agent.py:graph"}, + "dependencies": ["."], } with temporary_config_folder(config_content) as temp_dir: