-
Notifications
You must be signed in to change notification settings - Fork 6
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 Driver imports #74
Conversation
@@ -70,10 +79,7 @@ def squirrel_sources() -> List[Tuple[CatalogKey, Source]]: | |||
import squirrel_datasets_core.datasets as ds | |||
|
|||
for m in pkgutil.iter_modules(ds.__path__): | |||
try: | |||
with contextlib.suppress(AttributeError): |
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.
my IDE suggested this change, I think it's much cleaner that way. https://docs.python.org/3/library/contextlib.html
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.
agreed
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.
Just one comment about squirrel_plugin.py otherwise LG
@@ -36,6 +44,7 @@ def squirrel_drivers() -> List[Type[Driver]]: | |||
drivers = [] | |||
add_drivers = { |
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 also wrap this in a try/except block like below and catch any import errors? This would prevent squirrel from crashing when datasets is installed and some requirements are missing
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.
are you referring to line 42?
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.
Ah sorry, I got confused, please ignore this 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.
Thank you, LG!
Description
from squirrel_datasets_core.driver.huggingface import HuggingfaceDriver
thesquirrel_datasets_core.driver
is called, an since we have all the imports in there we also needed our users to install all of those dependencies, which is not good - because they might not even need them.squirrel_datasets_core.driver
module and ask users to directly import the respective driver from the respective submoduleType of change