Skip to content
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

MNT deprecate imports from snapshot_download #880

Merged
merged 3 commits into from
Jun 6, 2022
Merged

MNT deprecate imports from snapshot_download #880

merged 3 commits into from
Jun 6, 2022

Conversation

adrinjalali
Copy link
Contributor

In #874 we had to rename the snapshot_download.py file which makes from huggingface_hub.snapshot_download import blah fail.

This PR deprecated such imports and warns the user instead of failing.

Ref: scientific-python/lazy-loader#9

cc @LysandreJik @osanseviero

P.S.: I won't be available to apply suggestions here this week, but I think we should have this in the release. If you think anything needs to be changed in this PR, please apply the suggestions and then merge :)

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 23, 2022

The documentation is not available anymore as the PR was closed or merged.

@osanseviero
Copy link
Contributor

It seems test_snapshot_download_import is failing with ModuleNotFoundError https://github.com/huggingface/huggingface_hub/runs/6551770715?check_suite_focus=true

@LysandreJik
Copy link
Member

That looks very nice

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for working on it @adrinjalali! Only left a nit regarding testing.


def test_snapshot_download_import():
with pytest.warns(FutureWarning, match="has been made private"):
from huggingface_hub.snapshot_download import snapshot_download # noqa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also check that the method is the same as the one imported from from huggingface_hub import snapshot_download?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@LysandreJik
Copy link
Member

Perfect, thank you @adrinjalali!

@LysandreJik LysandreJik merged commit 3e8a06d into huggingface:main Jun 6, 2022
@adrinjalali adrinjalali deleted the lazy/backward branch June 7, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants