-
Notifications
You must be signed in to change notification settings - Fork 68
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
Improve AttributeError
warnings when using deprecated methods
#291
Conversation
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.
Nice one, looks good to me. 🚢
pinecone/deprecation_warnings.py
Outdated
@@ -0,0 +1,123 @@ | |||
def _build_class_migration_message(method_name: str, example: str): | |||
return f""" | |||
The {method_name} method is no longer top-level attribute of the pinecone package. |
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.
nit: ...is no longer a top-level attribute...
pinecone/deprecation_warnings.py
Outdated
""" | ||
|
||
msg = f""" | ||
The scale_index method is no longer top-level attribute of the pinecone package. |
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.
nit: ...is no longer a top-level attribute...
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.
LGTM
Problem
In v3.0, many methods have moved from the top-level namespace onto a class instance. We can throw more informative errors to help people migrate.
Solution
Add back stub implementations of methods that were removed. When called, they throw errors with useful documentation.
I simplified the expected args for all methods to
*args, **kwargs
which should match no matter what combination of arguments the user has provided.Type of Change
Test Plan
poetry run python3
and then try it:And
pinecone.init()