Improve message when evals isn't installed (#687)

New and improved error message

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Enhances dependency checks to display uv/pip install commands and
updates evals command accordingly; bumps package version to 1.5.9.
> 
> - **CLI utils**:
> - Update `require_dependency` to accept `uv_install_command` and
`pip_install_command` and format error message with both install
options.
> - **Evals command (`arcade_cli/main.py`)**:
> - Update `require_dependency` calls for `arcade_evals` and
`arcade_tdk` to provide uv/pip install commands.
> - **Version**:
> - Bump `project.version` in `pyproject.toml` from `1.5.8` to `1.5.9`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
217a6a87686e27747ef59d66bc0db05a270b294a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This commit is contained in:
Eric Gustin 2025-12-09 15:41:15 -08:00 committed by GitHub
parent 25dabbe75f
commit 489e01e149
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 9 deletions

View file

@ -382,7 +382,8 @@ def evals(
require_dependency( require_dependency(
package_name="arcade_evals", package_name="arcade_evals",
command_name="evals", command_name="evals",
install_command=r"pip install 'arcade-mcp\[evals]'", uv_install_command=r"uv tool install 'arcade-mcp[evals]'",
pip_install_command=r"pip install 'arcade-mcp[evals]'",
) )
# Although Evals does not depend on the TDK, some evaluations import the # Although Evals does not depend on the TDK, some evaluations import the
# ToolCatalog class from the TDK instead of from arcade_core, so we require # ToolCatalog class from the TDK instead of from arcade_core, so we require
@ -390,7 +391,8 @@ def evals(
require_dependency( require_dependency(
package_name="arcade_tdk", package_name="arcade_tdk",
command_name="evals", command_name="evals",
install_command=r"pip install arcade-tdk", uv_install_command=r"uv pip install arcade-tdk",
pip_install_command=r"pip install arcade-tdk",
) )
models_list = models.split(",") # Use 'models_list' to avoid shadowing models_list = models.split(",") # Use 'models_list' to avoid shadowing

View file

@ -961,20 +961,25 @@ def resolve_provider_api_key(provider: Provider, provider_api_key: str | None =
def require_dependency( def require_dependency(
package_name: str, package_name: str,
command_name: str, command_name: str,
install_command: str, uv_install_command: str,
pip_install_command: str,
) -> None: ) -> None:
""" """
Display a helpful error message if the required dependency is missing. Display a helpful error message if the required dependency is missing.
Args: Args:
package_name: The name of the package to import (e.g., 'arcade_serve') package_name: The name of the package to import (e.g., 'arcade_serve')
command_name: The command that requires the package (e.g., 'serve') command_name: The command that requires the package (e.g., 'evals')
install_command: The command to install the package (e.g., "pip install 'arcade-mcp[evals]'") uv_install_command: The uv command to install the package (e.g., "uv tool install 'arcade-mcp[evals]'")
pip_install_command: The pip command to install the package (e.g., "pip install 'arcade-mcp[evals]'")
""" """
try: try:
importlib.import_module(package_name.replace("-", "_")) importlib.import_module(package_name.replace("-", "_"))
except ImportError: except ImportError:
handle_cli_error( error_message = (
f"The '{package_name}' package is required to run the '{command_name}' command but is not installed. " f"The '{package_name}' package is required to run the '{command_name}' command but is not installed.\n\n"
f"To install it, run the following command: {install_command}" f"To install it:\n"
f" - If using uv: {uv_install_command}\n"
f" - If using pip: {pip_install_command}"
) )
handle_cli_error(error_message)

View file

@ -1,6 +1,6 @@
[project] [project]
name = "arcade-mcp" name = "arcade-mcp"
version = "1.5.8" version = "1.5.9"
description = "Arcade.dev - Tool Calling platform for Agents" description = "Arcade.dev - Tool Calling platform for Agents"
readme = "README.md" readme = "README.md"
license = {file = "LICENSE"} license = {file = "LICENSE"}