diff --git a/Project.toml b/Project.toml index d806621b..1ad9c0db 100644 --- a/Project.toml +++ b/Project.toml @@ -15,6 +15,14 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df" Scratch = "6c6a2e73-6563-6170-7368-637461726353" UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed" +[weakdeps] +Requires = "ae029012-a4dd-5104-9daa-d747884805df" +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" + +[extensions] +Requires = "Requires" +DataFrames = "DataFrames" + [compat] FileIO = "1.0.6" JLD2 = "0.4.15" diff --git a/src/DrWatson.jl b/src/DrWatson.jl index 4a4fc30c..736491e0 100644 --- a/src/DrWatson.jl +++ b/src/DrWatson.jl @@ -51,7 +51,18 @@ include("saving_files.jl") include("dict_list.jl") # Functionality that requires Dataframes and other heavy dependencies: -using Requires + +if !isdefined(Base, :get_extension) + using Requires + end + + function __init__() + # Other init functionality here + + @static if !isdefined(Base, :get_extension) + @require DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" + end + end # Update messages using Scratch diff --git a/src/result_collection.jl b/src/result_collection.jl index 42ce4791..97ac3397 100644 --- a/src/result_collection.jl +++ b/src/result_collection.jl @@ -1,5 +1,7 @@ export collect_results, collect_results! +isdefined(Base, :get_extension) ? (using DataFrames) : (using ..DataFrames) + """ collect_results!([filename,] folder; kwargs...) -> df