The Juno.jl Front-End
Juno provides some functionality using Atom's UI, which will usually have a fallback for use in other environments.
isactive() function will provide an interface for figuring out whether the current session is running within Juno:
true when the current Julia process is connected to a running Juno frontend.
Juno.jl includes features which allow package developers to created enhanced displays in Juno.
For example, we can print
info to the console in a nicer way:
Show the given message in Juno's console using blue styling, or fall back to
In a package, you can use
import Juno: info to replace the default version with this one.
or provide structured display for arbitrary objects (similar to
x's underlying representation, rather than using its normal display method.
structure(:(2x+1)) displays the
Expr object with its
args fields instead of printing the expression.
Profiles collected by
@profile can be displayed as a flame chart (similar to
ProfileView.jl) inside of Juno by calling
Juno.profiletree() will display the stack trace similar to the output of Base's
Profile.print(). There's also a
@profiler macro which does the same as
@profile but also displays the collected information as a flame chart and clears all collected backtraces beforehand.
Show currently collected profile information as an in-editor flamechart.
Show currently collected profile information in tree-form. Falls back to
Clear currently collected profile traces, profile the provided expression and show it via
Clicking on one of the boxes in the profile view will take you to the corresponding file/line. The length of the lines in the editor correspond to the percentage of calls made in that line; to clear the profile view and the in-editor display, click the
Forget Plot button in the profile view toolbar.
Juno.jl allows package developers to use the progress bar which is provided in the Atom window. For example, you can easily show a progress meter for a
for loop via the command:
@progress for ...
The following functions provide this interface:
@progress [name] for i = ...
Show a progress metre for the given loop if possible.
p's progress to
p to an indeterminate progress bar.
progress(f::Function; name = "", msg = "")
p = ProgressBar(name = name, msg = msg) as the argument and calls
done(p) afterwards. This is guaranteed to clean up the progress bar, even if
ProgressBar(;name = "", msg = "")
Create a new progress bar and register it with Juno, if possible.
Take care to unregister the progress bar by calling
done on it, or use the
progress(f::Function) syntax, which will handle that automatically.
Update the message that will be displayed in the frontend when hovering over the corrseponding progress bar.
Update the string that will be displayed to the right of the progress bar.
Defaults to the linearly extrpolated remaining time based upon the time difference between registering a progress bar and the latest update.
p from the frontend.
It is recommended to either use the
@progress macro or the
progress(name = "Foo") do p end
notation to ensure that the progress bars are properly unregistered in the frontend.
Juno.jl lets package developers interact with users via the Atom frontend. For example, you can allow the user to select from a list of options:
selector([xs...]) -> x
Allow the user to select one of the
xs should be an iterator of strings. Currently there is no fallback in other environments.
or get input in the console:
input(prompt = "") -> "..."
Prompt the user to input some text, and return it. Optionally display a prompt.
msg as an OS specific notification.
Useful for signaling the end of a long running computation or similar. This disregards the
Notifications setting in
julia-client. Falls back to
info(msg) in other environments.
As of version 0.5.11 of Atom.jl,
Base.readline() will also correctly request user input from the console instead of stalling indefinitely.