Requires is a Julia package that will magically make loading packages faster, maybe. It supports specifying glue code in packages which will load automatically when a another package is loaded, so that explicit dependencies (and long load times) can be avoided.
Usage is as simple as
media(::MyType) = Textual()
@require Gadfly begin
media(::Gadfly.Plot) = Graphical()
end
For larger amounts of code you can also use @require Package include("glue.jl")
.
The code wrapped by @require
will execute as soon as the given package is loaded
(which may be immediately).
julia> using Requires
julia> @require DataFrames println("foo")
julia> using DataFrames
foo
julia> @require DataFrames println("bar")
bar
Note that the package is not imported by default – you need an explicit using
statement if you want to use the packages names without qualifying them.
See here for some more detailed examples.