Repository navigation
feat: add vendor lazy-loader, storage settings - #1482
Conversation
Introduce an 's3' optional dependency in pyproject.toml (boto3>=1.35.49 and botocore) and update the internal vendor package to advertise and lazily expose boto3 and botocore. The vendor __init__ changes add them to TYPE_CHECKING, __all__, _LAZY_IMPORTS and _EXTRA_DEPS so they can be imported via the vendoring helper and mapped to the new 's3' extra to enable S3-related integrations.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求主要引入了第三方库的延迟加载功能,旨在提高应用程序的性能和可维护性,特别是在处理按需导入的包时。同时,它为未来的文件存储功能奠定了基础,通过添加S3协议的配置参数,并引入了相关的依赖项。此外,还对GitHub的Issue模板进行了标准化更新。 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a lazy-loading mechanism for optional dependencies and adds S3 configuration for future file storage. While the lazy-loading implementation is well-structured and secure, a critical security concern exists: the S3Settings model in swanlab/sdk/internal/settings/s3.py uses plain strings for sensitive credentials (access_key and secret_key), risking accidental leakage. It is highly recommended to update these fields to use Pydantic's SecretStr for enhanced security. Additionally, the PR could benefit from improvements in dependency management, API design, and the robustness of configuration validation, as detailed in the specific review comments.
Add Pydantic before-model validators to reassemble flattened environment variables into nested dicts for Integration (webhook, dashboard) and Save (s3) settings so env-splitting (max_split=1) produces correct nested structures. Change S3 endpoint validation to reject values that include http:// or https:// (guide to use s3_use_ssl instead) instead of silently stripping protocol. Remove botocore from vendor imports and project optional-dependencies, and add unit tests covering integration env parsing and S3 validation/behavior.
Description
添加提供商懒加载和save的s3协议参数,后者主要为未来功能做准备
懒加载的背景是,在之前的开发中有很多按需倒入的包,每次使用
try...catch首先比较容易出错,其次无法统一管理报错信息,因此增加了这一特性同时添加了boto3和botocore的依赖项
此外还修复了一些测试问题
最后更新了issue模版