-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: move builtin stars to astrbot package #4209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: move builtin stars to astrbot package #4209
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - 我发现了 1 个问题,并且给出了一些整体性的反馈:
_get_plugin_modules中留下的print(plugins)看起来是调试遗留代码,应该移除或改成合适的日志记录,以避免在生产环境中向 stdout 输出多余的噪声。- 在
is_plugin_path中,直接在规范化后的路径里检查字面子串"astrbot/builtin_stars/",在 Windows 上以及不同路径结构下可能会比较脆弱;建议使用os.path.sep,结合norm_path.split(os.path.sep)里的成员检查,或者基于Path的检查方式,以提升可移植性和健壮性。
面向 AI Agents 的提示
Please address the comments from this code review:
## Overall Comments
- `_get_plugin_modules` 中留下的 `print(plugins)` 看起来是调试遗留代码,应该移除或改成合适的日志记录,以避免在生产环境中向 stdout 输出多余的噪声。
- 在 `is_plugin_path` 中,直接在规范化后的路径里检查字面子串 `"astrbot/builtin_stars/"`,在 Windows 上以及不同路径结构下可能会比较脆弱;建议使用 `os.path.sep`,结合 `norm_path.split(os.path.sep)` 里的成员检查,或者基于 `Path` 的检查方式,以提升可移植性和健壮性。
## Individual Comments
### Comment 1
<location> `astrbot/core/star/star_manager.py:164` </location>
<code_context>
for p in _p:
p["reserved"] = True
plugins.extend(_p)
+ print(plugins)
return plugins
</code_context>
<issue_to_address>
**issue:** 使用结构化日志来移除或替换裸 `print` 语句。
`_get_plugin_modules` 中的这句 `print(plugins)` 会在每次插件发现时执行,并产生嘈杂且不可配置的输出。如果不再需要,请将其删除;如果仍然需要这些信息,请通过项目的日志记录器,并使用合适的日志级别(例如 debug)来输出。
</issue_to_address>帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码评审。
Original comment in English
Hey - I've found 1 issue, and left some high level feedback:
- The
print(plugins)left in_get_plugin_moduleslooks like a debugging artifact and should be removed or replaced with proper logging to avoid noisy stdout in production. - In
is_plugin_path, checking for the literal substring"astrbot/builtin_stars/"in a normalized path may be brittle on Windows and with varying path layouts; consider usingos.path.sepandin norm_path.split(os.path.sep)orPath-based checks for portability and robustness.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `print(plugins)` left in `_get_plugin_modules` looks like a debugging artifact and should be removed or replaced with proper logging to avoid noisy stdout in production.
- In `is_plugin_path`, checking for the literal substring `"astrbot/builtin_stars/"` in a normalized path may be brittle on Windows and with varying path layouts; consider using `os.path.sep` and `in norm_path.split(os.path.sep)` or `Path`-based checks for portability and robustness.
## Individual Comments
### Comment 1
<location> `astrbot/core/star/star_manager.py:164` </location>
<code_context>
for p in _p:
p["reserved"] = True
plugins.extend(_p)
+ print(plugins)
return plugins
</code_context>
<issue_to_address>
**issue:** Remove or replace the raw print statement with structured logging.
This `print(plugins)` in `_get_plugin_modules` runs on every discovery and adds noisy, unconfigurable output. Please remove it, or route it through the project logger at an appropriate level (e.g., debug) if you still need this information.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
astrbot/core/star/star_manager.py
Outdated
| for p in _p: | ||
| p["reserved"] = True | ||
| plugins.extend(_p) | ||
| print(plugins) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: 使用结构化日志来移除或替换裸 print 语句。
_get_plugin_modules 中的这句 print(plugins) 会在每次插件发现时执行,并产生嘈杂且不可配置的输出。如果不再需要,请将其删除;如果仍然需要这些信息,请通过项目的日志记录器,并使用合适的日志级别(例如 debug)来输出。
Original comment in English
issue: Remove or replace the raw print statement with structured logging.
This print(plugins) in _get_plugin_modules runs on every discovery and adds noisy, unconfigurable output. Please remove it, or route it through the project logger at an appropriate level (e.g., debug) if you still need this information.
…in-stars-to-astrbot-package
fixes: #4202
Modifications / 改动点
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Summary by Sourcery
将内置插件从旧的
packages目录迁移到astrbot/builtin_stars包中,并相应更新核心引用。增强内容:
astrbot.builtin_stars而不是packages中加载内置插件。pyproject.toml中的包含源路径里移除packages。文档:
astrbot/builtin_stars/。Original summary in English
Summary by Sourcery
Move built-in plugins from the legacy
packagesdirectory into theastrbot/builtin_starspackage and update core references accordingly.Enhancements:
astrbot.builtin_starsinstead ofpackages.packagesfrom the included source paths inpyproject.toml.Documentation:
astrbot/builtin_stars/location for built-in plugins.