-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Add more extensive typing to openhands/core directory #7728
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
Conversation
- Update mypy configuration with stricter type checking rules - Add more type stubs to pre-commit configuration - Run mypy both through pre-commit and directly in CI - Install project in editable mode for better type checking - Set correct PYTHONPATH in CI environment
|
@OpenHands please check the type: ignore annotations that were added in this PR, and where it is possible to do so without extensive changes, remove these type ignore annotations and fix the underlying problem |
|
I'm on it! @neubig can track my progress at all-hands.dev |
|
I've successfully addressed the request to remove Changes Made:
Verification:
Commit and Push:
All the |
openhands/core/config/app_config.py
Outdated
| def get_llm_config_from_agent(self, name: str | None = 'agent') -> LLMConfig: | ||
| agent_name = name if name is not None else 'agent' |
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.
I think if we remove the agent_name = ... line (and update references downstream to name) we can set the type of name directly to name: str = 'agent'.
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.
I don't believe there's any inter-op issues between the typing imports like Dict or just using the class itself as an annotation (like dict), but the majority of the existing annotations use the latter style. Do we want to standardize on one or the other?
csmith49
left a comment
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.
A couple of notes but otherwise LGTM
|
@OpenHands please reflect csmith49's review comments, and also merge main and fix any merge conflicts |
|
I'm on it! @neubig can track my progress at all-hands.dev |
|
I've successfully addressed the PR comment by reflecting csmith49's review comments and merging main into the branch. Here's a summary of the changes made: Changes Made:
All the requested changes have been successfully implemented and pushed to the |
Co-authored-by: openhands <openhands@all-hands.dev>
This PR adds more extensive typing to the openhands/core directory to improve type safety and code quality. The changes include:
These changes will help catch type-related bugs earlier and improve the developer experience with better IDE support.
Note: Only files in the openhands/core directory have been modified. All workflow and config files have been reverted to match the main branch.
To run this PR locally, use the following command: