-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: add DeprecationWarning for PaLM2TextEmbeddingGenerator #1018
Conversation
bigframes/deprecation.py
Outdated
|
||
@functools.wraps(func1) | ||
def new_func1(*args, **kwargs): | ||
warnings.simplefilter("always", DeprecationWarning) |
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.
Please don't override people's default filters. Just use FutureWarning as recommended here: https://docs.python.org/3/library/warnings.html
See this note:
Changed in version 3.7: Previously DeprecationWarning and FutureWarning were distinguished based on whether a feature was being removed entirely or changing its behaviour. They are now distinguished based on their intended audience and the way they’re handled by the default warnings filters.
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.
Done.
bigframes/deprecation.py
Outdated
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.
Can we put this in bigframes._core.deprecation
? I know we haven't been the best at not polluting the bigframes.*
namespace with private stuff, but since this isn't an API intended to be used by end users, I'd like to keep it clear that it's "private" to our 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.
removed the file, using typing_extension instead.
Consider using https://typing-extensions.readthedocs.io/en/latest/#typing_extensions.deprecated instead, as that also works well with type checkers such as |
Done |
with pytest.warns(exceptions.ApiDeprecationWarning): | ||
try: | ||
llm.PaLM2TextEmbeddingGenerator() | ||
except (Exception): |
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.
It feels like we are also ignoring all the exceptions? I wonder if we could just let it be raised and fail this test, if such a case occurs.
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.
The backend is already unavailable now. The exception is expected. We only want to check the warnings.
No description provided.