Skip to content
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

fix: don't use deprecated api in toolset #987

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

tushar-composio
Copy link
Contributor

@tushar-composio tushar-composio commented Dec 11, 2024

Entity.execute is marked as deprecated for the users and will only be used internally in the SDK.


Important

Replace deprecated Entity.execute with internal _execute method in toolset.py and update Entity class in __init__.py.

  • Behavior:
    • Replace deprecated Entity.execute with Entity._execute in _execute_remote() in toolset.py.
  • Functions:
    • Add _execute() method in Entity class in __init__.py to handle execution internally.
  • Misc:
    • Mark Entity.execute as deprecated for external use in __init__.py.

This description was created by Ellipsis for 76b009b. It will automatically update as commits are pushed.

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 8:56am

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to e120e28 in 17 seconds

More details
  • Looked at 36 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. python/composio/tools/toolset.py:492
  • Draft comment:
    Changed execute to _execute to avoid using deprecated methods. This aligns with the intent to use non-deprecated methods internally.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_AEsX1RjEwSc8jlyj


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -251,6 +251,17 @@ def execute(
:param session_id: ID of the current workspace session
:return: Dictionary containing execution result
"""
self._execute(action, params, connected_account_id, session_id, text, auth)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execute() method is not returning the result of _execute(). This could lead to unexpected behavior since callers expecting a return value will receive None. Please add a return statement:

def execute(self, ...):
    return self._execute(action, params, connected_account_id, session_id, text, auth)

@shreysingla11
Copy link
Collaborator

Code Review Summary

The changes look generally good and move in the right direction by refactoring deprecated API usage. Here's a summary of the review:

Positive Points

✅ Good separation of concerns by moving core logic to private method
✅ Maintains backward compatibility while preparing for API changes
✅ Proper type hints in the new method signature
✅ Minimal and focused changes

Areas for Improvement

  • Missing return statement in public execute() method
  • Documentation needed for new _execute() method
  • Consider adding return type hints to both methods

Overall Assessment

The code quality is good (7/10) with minor improvements needed around documentation and return value handling. The refactoring approach is solid and follows good practices for managing deprecated functionality.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 43691a4 in 10 seconds

More details
  • Looked at 15 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_Nj95CIiKij5sn8Tw


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on 76b009b in 36 seconds

More details
  • Looked at 14 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_4esfAOpCTGnzYK3S


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -489,7 +489,8 @@ def _execute_remote(
if auth is None:
self.check_connected_account(action=action)

output = self.client.get_entity(id=entity_id).execute(
entity = self.client.get_entity(id=entity_id)
output = entity._execute( # pylint: disable=protected-access
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a protected member _execute directly is not a best practice. Consider providing a public method in the Entity class to handle this functionality.

@tushar-composio tushar-composio merged commit e57f95e into master Dec 12, 2024
10 checks passed
@tushar-composio tushar-composio deleted the dont-use-deprecated-entity branch December 12, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants