UseAll.jl provides @useall, a macro that brings all useful names from one or more modules into the current module.
using UseAll
@useall TOML Base.IteratorsAfter that, names such as countfrom can be used directly, without writing Base.Iterators.countfrom.
Submodules of the current module are detected automatically, so if you defined a module at the REPL you can write:
module MyModule
f(x) = x + 1
end
@useall MyModule # The Julia parser does not accept `@useall .MyModule` here.This is useful while working in the REPL: By pulling names from a package or submodule into Main, you can execute copy-pasted code from a module. That means all your previous definitions in your REPL session or from your startup.jl remain available. You can also add the names from more than one module and can execute their copy-pasted code without doing anything else in-between.
It is also useful in closely coupled code, for example in a package's own runtests.jl, where explicit imports can become noisy and the code intentionally works with many internals of the same package.
@useall imports public and non-public names, including names imported into the source module, while skipping hidden compiler-generated names and names already present in the target module such as eval and include.
importdoes not import any binding which is not explicitly listed.usingandImportAll.jlonly import the exported bindings.REPL.activate(mod)changes the evaluation context, but then you are no longer working naturally inMain; existing bindings fromMainare not directly part of that workflow, and it only targets one active module at a time.Reexport.jlmust be set up inside a package by the package author to forward APIs; it is not something you trigger ad hoc from the REPL.
Do not use UseAll.jl in a regular package. If code side-steps module access boundaries and relies on internals, that usually points to a poor design. UseAll.jl is intended for debugging, interactive exploration and deliberately tightly coupled code, not as a general design pattern.
UseAll.jl ships two optional package extensions:
Reviseintegration: whenRevise.jlis loaded, newly added symbols toMyModuleare brought in automatically into the namespace of your currently active module (typicallyMain) after you did a@useall MyModule.REPLintegration: tab completion for@useallarguments, reusing Julia's REPL completion behavior forusing.
Both extensions rely on private Julia or package internals. They are therefore provided on a best-effort basis and are designed to fail silently on Julia versions or environments where the required internals are unavailable or have changed.