Skip to content

Commit

Permalink
[CLI] Nonblocking debugpy
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Nov 28, 2024
1 parent 1130c3a commit 4836007
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
15 changes: 10 additions & 5 deletions libs/cli/langgraph_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,12 @@ def dockerfile(save_path: str, config: pathlib.Path, add_docker_compose: bool) -
type=int,
help="Enable remote debugging by listening on specified port. Requires debugpy to be installed",
)
@click.option(
"--wait-for-client",
is_flag=True,
help="Wait for a debugger client to connect to the debug port before starting the server",
default=False,
)
@cli.command(
"dev",
help="🏃‍♀️‍➡️ Run LangGraph API server in development mode with hot reloading and debugging support",
Expand All @@ -563,6 +569,7 @@ def dev(
n_jobs_per_worker: Optional[int],
no_browser: bool,
debug_port: Optional[int],
wait_for_client: bool,
):
"""CLI entrypoint for running the LangGraph API server."""
try:
Expand Down Expand Up @@ -595,9 +602,6 @@ def dev(
sys.path.append(str(dep_path))

graphs = config_json.get("graphs", {})
additional_config = {}
if config_json.get("store"):
additional_config["store"] = config_json["store"]

run_server(
host,
Expand All @@ -607,8 +611,9 @@ def dev(
n_jobs_per_worker=n_jobs_per_worker,
open_browser=not no_browser,
debug_port=debug_port,
env=config_json.get("env", None),
config=additional_config,
env=config_json.get("env"),
store=config_json.get("store"),
wait_for_client=wait_for_client,
)


Expand Down
16 changes: 6 additions & 10 deletions libs/cli/langgraph_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,12 @@ def python_config_to_docker(config_path: pathlib.Path, config: Config, base_imag
],
)
)
additional_config = {}
if config.get("store"):
additional_config["store"] = config["store"]
store_config = config.get("store")
env_additional_config = (
""
if not additional_config
if not store_config
else f"""
ENV LANGGRAPH_CONFIG='{json.dumps(additional_config)}'
ENV LANGGRAPH_STORE='{json.dumps(store_config)}'
"""
)
return f"""FROM {base_image}:{config['python_version']}
Expand Down Expand Up @@ -439,14 +437,12 @@ def test_file(file_name):
install_cmd = "npm ci"
else:
install_cmd = "npm i"
additional_config = {}
if config.get("store"):
additional_config["store"] = config["store"]
store_config = config.get("store")
env_additional_config = (
""
if not additional_config
if not store_config
else f"""
ENV LANGGRAPH_CONFIG='{json.dumps(additional_config)}'
ENV LANGGRAPH_STORE='{json.dumps(store_config)}'
"""
)
return f"""FROM {base_image}:{config['node_version']}
Expand Down
8 changes: 4 additions & 4 deletions libs/cli/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions libs/cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langgraph-cli"
version = "0.1.60"
version = "0.1.61"
description = "CLI for interacting with LangGraph API"
authors = []
license = "MIT"
Expand All @@ -14,7 +14,7 @@ langgraph = "langgraph_cli.cli:cli"
[tool.poetry.dependencies]
python = "^3.9.0,<4.0"
click = "^8.1.7"
langgraph-api = { version = ">=0.0.5,<0.1.0", optional = true, python = ">=3.11,<4.0" }
langgraph-api = { version = ">=0.0.6,<0.1.0", optional = true, python = ">=3.11,<4.0" }
python-dotenv = { version = ">=0.8.0", optional = true }

[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 4836007

Please sign in to comment.