BasicAutoloads.jl

"whenever I type this in the REPL, run that for me"
Author LilithHafner
Popularity
33 Stars
Updated Last
5 Months Ago
Started In
April 2024

BasicAutoloads

Build Status Coverage PkgEval Aqua

BasicAutoloads lets you say "whenever I type this in the REPL, run that for me". It's great for automatically loading interactive tools.

For example, put this in your startup.jl

if isinteractive()
    import BasicAutoloads
    BasicAutoloads.register_autoloads([
        ["@b", "@be"]            => :(using Chairmarks),
        ["@benchmark"]           => :(using BenchmarkTools),
        ["@test", "@testset", "@test_broken", "@test_deprecated", "@test_logs",
        "@test_nowarn", "@test_skip", "@test_throws", "@test_warn", "@inferred"] =>
                                    :(using Test),
        ["@about"]               => :(using About; macro about(x) Expr(:call, About.about, x) end),
    ])
end

Add BasicAutoloads and any packages you want to automatically load to your default environment, and then enjoy the benefits at the REPL:

julia> Test
ERROR: UndefVarError: `Test` not defined in `Main`
Suggestion: check for spelling errors or missing imports.

julia> @test 1+1 == 2 # Test is automatically loaded here
Test Passed

julia> Test
Test

Scripts and such will still need to explicitly load their deps.

For more details, see the docstring of register_autoloads