-
Notifications
You must be signed in to change notification settings - Fork 170
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
Remove boto3 from types #741
Conversation
57732a7
to
aa3d791
Compare
griptape/schemas/base_schema.py
Outdated
|
||
# These modules are required to avoid `NameError`s when resolving types. | ||
from griptape.drivers import BaseConversationMemoryDriver, BasePromptDriver, BasePromptModelDriver | ||
from griptape.structures import Structure | ||
from griptape.utils import PromptStack | ||
from griptape.tokenizers.base_tokenizer import BaseTokenizer | ||
import boto3 | ||
|
||
boto3 = import_optional_dependency("boto3") if is_dependency_installed("boto3") else {} |
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.
If this is ever needed in more than one place, then might be nice to have something like try_import_optional_dependency()
.
Btw, what happens if you default to None
instead of {}
?
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.
Honestly not totally sure, I think it was working fine with both. But I updated to a more appropriate value Any
since that's an actual python type.
6d38011
to
8a412d4
Compare
8a412d4
to
726f0f8
Compare
Fixes serialization crash when
boto3
is not installed via extras.Side effect of this is that we cannot useboto3
type hints (boto.Session) in any serializable fields.