diff --git a/libs/cli/langgraph_cli/cli.py b/libs/cli/langgraph_cli/cli.py index d651529a3..5ee4a788f 100644 --- a/libs/cli/langgraph_cli/cli.py +++ b/libs/cli/langgraph_cli/cli.py @@ -576,16 +576,18 @@ def dev( from langgraph_api.cli import run_server except ImportError: try: - import pkg_resources - - pkg_resources.require("langgraph-api-inmem") - except (ImportError, pkg_resources.DistributionNotFound): + from importlib import util + + if not util.find_spec("langgraph_api"): + raise click.UsageError( + "Required package 'langgraph-api' is not installed.\n" + "Please install it with:\n\n" + ' pip install -U "langgraph-cli[inmem]"\n\n' + ) from None + except ImportError: raise click.UsageError( - "Required package 'langgraph-api-inmem' is not installed.\n" - "Please install it with:\n\n" - ' pip install -U "langgraph-cli[inmem]"\n\n' - "If you're developing the langgraph-cli package locally, you can install in development mode:\n" - " pip install -e ." + "Could not verify package installation. Please ensure Python is up to date and\n" + "langgraph-cli is installed with the 'inmem' extra: pip install -U \"langgraph-cli[inmem]\"" ) from None raise click.UsageError( "Could not import run_server. This likely means your installation is incomplete.\n" @@ -614,6 +616,7 @@ def dev( env=config_json.get("env"), store=config_json.get("store"), wait_for_client=wait_for_client, + auth=config_json.get("auth"), ) diff --git a/libs/cli/langgraph_cli/config.py b/libs/cli/langgraph_cli/config.py index 1b178485f..85fce03cf 100644 --- a/libs/cli/langgraph_cli/config.py +++ b/libs/cli/langgraph_cli/config.py @@ -61,7 +61,7 @@ class Config(TypedDict, total=False): graphs: dict[str, str] env: Union[dict[str, str], str] store: Optional[StoreConfig] - auth: Optional[dict[str, str]] + auth: Optional[AuthConfig] def _parse_version(version_str: str) -> tuple[int, int]: diff --git a/libs/cli/tests/unit_tests/test_config.py b/libs/cli/tests/unit_tests/test_config.py index 6da247077..bd4cb881c 100644 --- a/libs/cli/tests/unit_tests/test_config.py +++ b/libs/cli/tests/unit_tests/test_config.py @@ -31,6 +31,7 @@ def test_validate_config(): "dockerfile_lines": [], "env": {}, "store": None, + "auth": None, **expected_config, } actual_config = validate_config(expected_config) @@ -48,6 +49,7 @@ def test_validate_config(): }, "env": env, "store": None, + "auth": None, } actual_config = validate_config(expected_config) assert actual_config == expected_config