-
Notifications
You must be signed in to change notification settings - Fork 183
Feature/open api #1414
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
base: main
Are you sure you want to change the base?
Feature/open api #1414
Conversation
* feat: get all project of a group * update unit test using magicMock * update unit test & fix bug * opt import and rename some file - move api from folder core_python to api * fix wrong comment * remove pending status when getting entity projects * opt Project class - add EN comment for Project properties - add __str__ method for project label - adapt snake_case naming for project properties - change some project property name: projectLabels -> label - change api.projects() param name: entity -> workspace - delete some project properties (group, cuid) - prase url inside Project class * dynamically request project data according to the traversal of the project, rather than requesting all project information at once * opt import * iteratively request project data inside the Projects class - move api form api package to core_python package * fix bug & add type * move api's type.py to core_python
* feat: get runs metadata - add api in core_python to get all exps in a project - add new type and class to parse exps * update unit test & fix bugs * opt code style & add comment * raise value error if user's path is invaded * fix bug of Incorrectly raised ValueError * get single exp through OpenApi * resolve conflicts: filtering exp (basic implement) - get full single exp info through filter func # Conflicts: # swanlab/core_python/api/experiment.py * opt __dict__ for project and experiment * resolve conflict: update run.history() * feat: update run.scan_history() - add example codes * resolve conflict: fix bugs when importing pandas * import pandas only when used * fix: pandas warning * feat: run and user features of OpenApi - get metric data in batch - recover old OpenApi version for smooth transition - create & delete api_key through Api.user * opt Client importing in core_python's api * opt logic of run.history() - get latest api_keys when user delete api_key * rename the deprecated openApi folder * refactored run.history() & add return type - add return type for the backend interfaces - simplified get_experiment_metrics() and handle the csv inside HistoryPool * removed redundant types * update unit test using mock * feat: get user's team * feat: create user if user is the root user in self-hosted swanlab - refactor the models in OpenApi * feat: update unit test for create user and get user teams * delete test code of OpenApi * use ThreadPoolExecutor in HistoryPool * Refactor Api class and cleanup api module structure Moved the Api class implementation from swanlab/api/api.py to swanlab/api/__init__.py and deleted the redundant api.py file. Updated imports and references accordingly. Minor docstring and comment improvements, and fixed a message in thread.py to reference 'Api' instead of 'OpenApi'. * Fix circular import by updating Api export Combined the import of OpenApi and Api from .api to prevent circular import issues and simplify the export process. --------- Co-authored-by: ZeYi Lin <[email protected]> Co-authored-by: Kang Li <[email protected]>
* Refactor the OpenAPI codes, managing the code with a modular approach * combine 3 kinds of user into one - use @cached_property to cache some property of user * Place the API's custom type into a separate module - place class ApiBase into a single model * get the user identity at the init of the OpenApi - only the root user get by api.user() can create new account * refactor module name & structure in api and core_python * Modified parameter passing convention & add client property to ApiBase - pass param through kwargs except client in OpenApi and core_python * update code commit - opt str() of Label class
Summary of ChangesHello @SAKURA-CAT, 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! 此拉取请求对 SwanLab 的 OpenAPI 接口进行了全面重构和升级。核心目标是提供一个更现代化、面向对象且易于使用的编程接口,以便用户能够更高效地通过代码与 SwanLab 平台进行交互。通过引入新的 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. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 对 OpenAPI 模块进行了一次重大的、结构清晰的重构。新的 swanlab.Api 类提供了更现代化、面向对象的接口,同时旧的 OpenApi 也被妥善地标记为弃用。代码被组织到清晰的项目、实验和用户模块中,极大地提高了可维护性。我发现了一些关键问题,尤其是在迭代器逻辑和错误处理方面,以及一些可以提高效率和代码风格的地方。此外,为新的 API 添加单元测试将是确保其正确性和稳定性的重要一步。
* add unit test - add unit test and fix bugs of getting all projects through OpenApi - add unit tests for OpenApi runs and run.history() * add unit test for api.user() * accept suggestions from gemini
Description
全新的OpenAPI类型
Closes: #1369