chore: use from __future__ import annotations#30254
chore: use from __future__ import annotations#30254asukaminato0721 merged 9 commits intolanggenius:mainfrom
Conversation
Summary of ChangesHello @sarxxt, 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! This pull request focuses on a significant code quality improvement by modernizing Python type annotations. By consistently applying 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.
Code Review
This pull request is a great refactoring that modernizes the codebase by using from __future__ import annotations and removing quoted type hints. The changes are clean and improve readability.
I've found a recurring issue where some type hints, after being unquoted, rely on imports that are still inside if TYPE_CHECKING: blocks. This can lead to NameError at runtime when type hints are inspected. I've left comments on the specific occurrences I found. Please ensure all necessary imports are moved out of TYPE_CHECKING blocks to be available at runtime.
Overall, this is a valuable improvement. Keep up the great work!
Changes SummaryThis PR implements PEP 563 (from future import annotations) across 50 backend API files, enabling unquoted type annotations throughout the codebase. This is a pure refactoring that improves code readability and maintainability without any functional changes. Type: refactoring Components Affected: Core Entities (datasource, mcp_provider, provider_entities, message_entities, model_entities, etc.), Core Tools (builtin_tool, custom_tool, mcp_tool, plugin_tool, workflow_as_tool), Workflow System (nodes, graph, graph_engine, runtime, entities, repositories), RAG/Datasource (clickzetta_vector, dataset_docstore, queue), Models (workflow, provider, tools, model), Extensions (logstore, clickzetta_volume), Libraries (broadcast_channel, email_i18n), Tests (mock_config, tool_node tests) Files Changed
Full review in progress... | Powered by diffray |
| @asukaminato0721 do I need to make any updates? The comments showing are not based on the changes I made some are due the changes in these file. |
Summary
Fixes: #24303. This PR refactors type annotations across the codebase by enabling
from __future__ import annotationsand replacing quoted type annotations (e.g."T") with direct references (T). This is a refactor-only change with no functional or behavioral impact. The goal is to simplify type hints and improve readability andmaintainability.
Testing
Screenshots
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods