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

make default fetch fallback to Base.download #103

Merged
merged 9 commits into from
Sep 18, 2019
Merged

Conversation

oxinabox
Copy link
Owner

This should close #100,
The idea is that if a type has overloaded Base.download and Base.basename,
then that is generally enough for us to know what to do.

@rofinn can you review?

I'm tagging as a breaking change as I also want to drop deprecations.

@codecov-io
Copy link

codecov-io commented Sep 14, 2019

Codecov Report

Merging #103 into master will decrease coverage by 0.28%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   64.86%   64.58%   -0.29%     
==========================================
  Files          12       12              
  Lines         185      192       +7     
==========================================
+ Hits          120      124       +4     
- Misses         65       68       +3
Impacted Files Coverage Δ
src/types.jl 100% <ø> (ø) ⬆️
src/resolution_automatic.jl 59.52% <33.33%> (-2.98%) ⬇️
src/fetch_helpers.jl 83.33% <75%> (-2.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 936f315...7c28a23. Read the comment docs.

@oxinabox
Copy link
Owner Author

Maybe add to readme/ docstring for DataDep that if remote_path is a type that supports Base.basensme and Base.download then the default fetch method will work.
Otherwise you need to set the fetch method

Copy link
Collaborator

@rofinn rofinn left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor suggestions

See also [`fetch_base`](@ref) and [`fetch_http`](@ref).
"""
function fetch_default(remotepath, localdir)
if remotepath isa AbstractString && occursin(r"^https?://", remotepath)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe include a link to the discussion on base as to why these are different?

JuliaLang/julia#33088

Copy link
Owner Author

Choose a reason for hiding this comment

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

Not really relevent I think.
Real difference is wither we need to use Base.basename or that we have a download that can get it right on its own.
Not so much about joinpath stuff

src/resolution_automatic.jl Outdated Show resolved Hide resolved
# This is easy because the filename is in the URL
# So it works with both `fetch_base` and `fetch_http`
# HTTP.jl has tests for much more difficult cases, and fetch_http supports those
@testset "$fetch" for fetch in (fetch_default, fetch_base, fetch_http)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pretty minor, but I might be inclined to rename fetch to f or func to make it clear that we aren't trying to call the base fetch method in this loop.

Copy link
Owner Author

Choose a reason for hiding this comment

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

maybe fetch_func

oxinabox and others added 3 commits September 17, 2019 18:19
@oxinabox oxinabox merged commit c82892a into master Sep 18, 2019
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.

Downloading a DataDep from an ::AbstractPath
3 participants