Skip to content

Commit 7575061

Browse files
CopilotOhYee
andcommitted
fix(core): restore specificity in error message and add clarifying comment
Address code review feedback: - Restored "server" context in error message for better clarity - Added comment clarifying that all entries are for server-related dependencies - Maintains generic approach while preserving helpful context for users This ensures users get clear, specific error messages while keeping the code maintainable for future extensions. Co-authored-by: OhYee <[email protected]>
1 parent 54bb23b commit 7575061

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

agentrun/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@
291291

292292
# 可选依赖包映射:导入错误的包名 -> 安装使用的包名
293293
# Optional dependency mapping: import error package name -> installation package name
294+
# 所有 server 相关的可选依赖 / All server-related optional dependencies
294295
_OPTIONAL_PACKAGES = [
295296
("fastapi", "agentrun-sdk[server]"),
296297
("uvicorn", "agentrun-sdk[server]"),
@@ -315,7 +316,7 @@ def __getattr__(name: str):
315316
for package_name, install_name in _OPTIONAL_PACKAGES:
316317
if package_name in error_str:
317318
raise ImportError(
318-
f"'{name}' requires optional dependencies. "
319+
f"'{name}' requires the 'server' optional dependencies. "
319320
f"Install with: pip install {install_name}\n"
320321
f"Original error: {e}"
321322
) from e

0 commit comments

Comments
 (0)