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(
package_name="arcade_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
# ToolCatalog class from the TDK instead of from arcade_core, so we require
@ -390,7 +391,8 @@ def evals(
require_dependency(
package_name="arcade_tdk",
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

View file

@ -961,20 +961,25 @@ def resolve_provider_api_key(provider: Provider, provider_api_key: str | None =
def require_dependency(
package_name: str,
command_name: str,
install_command: str,
uv_install_command: str,
pip_install_command: str,
) -> None:
"""
Display a helpful error message if the required dependency is missing.
Args:
package_name: The name of the package to import (e.g., 'arcade_serve')
command_name: The command that requires the package (e.g., 'serve')
install_command: The command to install the package (e.g., "pip install 'arcade-mcp[evals]'")
command_name: The command that requires the package (e.g., '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:
importlib.import_module(package_name.replace("-", "_"))
except ImportError:
handle_cli_error(
f"The '{package_name}' package is required to run the '{command_name}' command but is not installed. "
f"To install it, run the following command: {install_command}"
error_message = (
f"The '{package_name}' package is required to run the '{command_name}' command but is not installed.\n\n"
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]
name = "arcade-mcp"
version = "1.5.8"
version = "1.5.9"
description = "Arcade.dev - Tool Calling platform for Agents"
readme = "README.md"
license = {file = "LICENSE"}