User reference

User reference

There are really only four functions that a user would be expected to call manually: revise, includet, Revise.track, and entr. Other user-level constructs might apply if you want to debug Revise or prevent it from watching specific packages.

Revise.reviseFunction.
revise()

eval any changes in the revision queue. See Revise.revision_queue.

source
revise(mod::Module)

Reevaluate every definition in mod, whether it was changed or not. This is useful to propagate an updated macro definition, or to force recompiling generated functions.

source
Revise.trackFunction.
Revise.track(Base)
Revise.track(Core.Compiler)
Revise.track(stdlib)

Track updates to the code in Julia's base directory, base/compiler, or one of its standard libraries.

source
Revise.track(mod::Module, file::AbstractString)
Revise.track(file::AbstractString)

Watch file for updates and revise loaded code with any changes. mod is the module into which file is evaluated; if omitted, it defaults to Main.

If this produces many errors, check that you specified mod correctly.

source
Revise.includetFunction.
includet(filename)

Load filename and track any future changes to it. includet is essentially shorthand for

Revise.track(Main, filename; define=true, skip_include=false)

includet is intended for "user scripts," e.g., a file you use locally for a specific purpose such as loading a specific data set or performing a particular analysis. Do not use includet for packages, as those should be handled by using or import. (If you're working with code in Base or one of Julia's standard libraries, use Revise.track(mod) instead, where mod is the module.) If using and import aren't working, you may have packages in a non-standard location; try fixing it with something like push!(LOAD_PATH, "/path/to/my/private/repos").

includet is deliberately non-recursive, so if filename loads any other files, they will not be automatically tracked. (See Revise.track to set it up manually.)

source
Revise.entrFunction.
entr(f, files; postpone=false, pause=0.02)
entr(f, files, modules; postpone=false, pause=0.02)

Execute f() whenever files listed in files, or code in modules, updates. entr will process updates (and block your command line) until you press Ctrl-C. Unless postpone is true, f() will be executed also when calling entr, regardless of file changes. The pause is the period (in seconds) that entr will wait between being triggered and actually calling f(), to handle clusters of modifications, such as those produced by saving files in certain text editors.

Example

entr(["/tmp/watched.txt"], [Pkg1, Pkg2]) do
    println("update")
end

This will print "update" every time "/tmp/watched.txt" or any of the code defining Pkg1 or Pkg2 gets updated.

source

Revise logs (debugging Revise)

Revise.debug_loggerFunction.
logger = Revise.debug_logger(; min_level=Debug)

Turn on debug logging (if min_level is set to Debug or better) and return the logger object. logger.logs contains a list of the logged events. The items in this list are of type Revise.LogRecord, with the following relevant fields:

  • group: the event category. Revise currently uses the following groups:
    • "Action": a change was implemented, of type described in the message field.
    • "Parsing": a "significant" event in parsing. For these, examine the message field for more information.
    • "Watching": an indication that Revise determined that a particular file needed to be examined for possible code changes. This is typically done on the basis of mtime, the modification time of the file, and does not necessarily indicate that there were any changes.
  • message: a string containing more information. Some examples:
    • For entries in the "Action" group, message can be "Eval" when modifying old methods or defining new ones, "DeleteMethod" when deleting a method, and "LineOffset" to indicate that the line offset for a method was updated (the last only affects the printing of stacktraces upon error, it does not change how code runs)
    • Items with group "Parsing" and message "Diff" contain sets :newexprs and :oldexprs that contain the expression unique to post- or pre-revision, respectively.
  • kwargs: a pairs list of any other data. This is usually specific to particular group/message combinations.

See also Revise.actions and Revise.diffs.

source
Revise.actionsFunction.
actions(logger; line=false)

Return a vector of all log events in the "Action" group. "LineOffset" events are returned only if line=true; by default the returned items are the events that modified methods in your session.

source
Revise.diffsFunction.
diffs(logger)

Return a vector of all log events that encode a (non-empty) diff between two versions of a file.

source

Prevent Revise from watching specific packages

Revise.dont_watch_pkgs

Global variable, use push!(Revise.dont_watch_pkgs, :MyPackage) to prevent Revise from tracking changes to MyPackage. You can do this from the REPL or from your .julia/config/startup.jl file.

See also Revise.silence.

source
Revise.silenceFunction.
Revise.silence(pkg)

Silence warnings about not tracking changes to package pkg.

source