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

Refactor Pooch.is_available to use downloaders #322

Merged
merged 4 commits into from
Sep 9, 2022
Merged

Conversation

leouieda
Copy link
Member

@leouieda leouieda commented Sep 5, 2022

The method checks if a file is available without downloading it. It used
an implementation independent of the downloaders and only supported
simple HTTP and FTP. To allow for more flexibility, allow the function
to take a downloader argument. Downloaders had to be modified to
include an optional check_only=False argument to do the checking and
return a bool instead of None. Pooch.is_available raises an exception if
the argument isn't supported by a given downloader, so we can retain
backwards compatibility. Allowed refactoring the FTP is_available test
to use the pytest-localftpserver instead of relying on a public server
somewhere (the UNAVCO one we used was decommissioned).

Relevant issues/PRs:

Should fix the CI failures seen in #318

The method checks if a file is available without downloading it. It used
an implementation independent of the downloaders and only supported
simple HTTP and FTP. To allow for more flexibility, allow the function
to take a *downloader* argument. Downloaders had to be modified to
include an optional check_only=False argument to do the checking and
return a bool instead of None. Pooch.is_available raises an exception if
the argument isn't supported by a given downloader, so we can retain
backwards compatibility. Allowed refactoring the FTP is_available test
to use the pytest-localftpserver instead of relying on a public server
somewhere (the UNAVCO one we used was decommissioned).
@leouieda
Copy link
Member Author

leouieda commented Sep 5, 2022

@andersy005 would you have a bit of time to take a look at this PR? You were the last to work on the file availability checks. Thanks!

@leouieda leouieda mentioned this pull request Sep 5, 2022
@leouieda
Copy link
Member Author

leouieda commented Sep 5, 2022

Just have to resolve some linting issues and add a test for the failure condition. But otherwise, some quick feedback on this would be appreciated 🙂

@leouieda
Copy link
Member Author

leouieda commented Sep 6, 2022

cc @santisoler who implemented this originally as well

Copy link
Member

@andersy005 andersy005 left a comment

Choose a reason for hiding this comment

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

Thank you for your patience, @leouieda ( i was on vacation when you last pinged me).

This looks solid to me 👍🏽. i like the idea of off-loading the availability checks to the downloader instead of special casing this in core.

@leouieda
Copy link
Member Author

leouieda commented Sep 9, 2022

Thanks @andersy005! No problem and I hope I didn't intrude on your time off. I appreciate the feedback. Hopefully with this we can add extend support to the DOI downloader as well in the future.

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.

2 participants