You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, when importing from huggingface_hub root module, autocomplete in IDE doesn't work (both method name + arguments/docstring). This is due to the lazy-loading have in __init__.py. From a UX perspective, It would be good to make the autocomplete work properly.
fromhuggingface_hubimportupload_file# <- lazy-loading but no autocompletefromhuggingface_hub.hf_apiimportupload_file# <- autocomplete but no lazy-loading
Tested in both vscode (+Python/Pylance extensions) and PyCharm.
Maybe a if TYPE_CHECKING with imports behind is enough to solve that.
Adding a quick note that autocomplete + lazy loading can work in parallel as we have seen in transformers. Also cc @sgugger who has worked on that in transformers.
I do believe a TYPE_CHECKING block would be enough to solve that, we have one in Transformers for this purpose and I think this is the only big difference between the two kinds of lazy loading (we have a different implementation not relying on Python 3.7 in Transformers but that does the same thing as huggingface_hub as far as I could tell).
It becomes annoying to have to make sure the two blocks are synchronized, which is why I built a quality script in Transformers to check the two parts of an init contain the same object.
At the moment, when importing from
huggingface_hub
root module, autocomplete in IDE doesn't work (both method name + arguments/docstring). This is due to the lazy-loading have in__init__.py
. From a UX perspective, It would be good to make the autocomplete work properly.Tested in both vscode (+Python/Pylance extensions) and PyCharm.
Maybe a
if TYPE_CHECKING
with imports behind is enough to solve that.(cc @LysandreJik who reported it to me)
Note: autocomplete works in
transformers
.The text was updated successfully, but these errors were encountered: