JolinPluto
API documentation for JolinPluto.
JolinPluto.NoPutJolinPluto.IPyWidgetJolinPluto.SetterBase.getJolinPluto.ChannelPlutoJolinPluto.ChannelWithRepeatedFillJolinPluto.MDJolinPluto._split_macro_argsJolinPluto.authenticate_tokenJolinPluto.cell_ids_create_wrapperJolinPluto.cell_ids_push!JolinPluto.clipboard_image_to_clipboard_htmlJolinPluto.embedLargeHTMLJolinPluto.format_htmlJolinPluto.is_running_in_jolinpluto_processJolinPluto.is_running_in_pluto_processJolinPluto.lang_enabledJolinPluto.lang_get_globalJolinPluto.lang_set_globalJolinPluto.output_belowJolinPluto.repeat_atJolinPluto.repeat_runJolinPluto.repeat_take!JolinPluto.viewofJolinPluto.@ChannelJolinPluto.@cell_ids_create_wrapperJolinPluto.@cell_ids_push!JolinPluto.@getJolinPluto.@repeat_atJolinPluto.@repeat_runJolinPluto.@repeat_take!
JolinPluto.NoPut — ConstantNoPutSpecial singleton value. It is used inside ChannelWithRepeatedFill to indicate that a specific repetition should not add any value to the Channel.
JolinPluto.IPyWidget — TypeIPyWidget(ipywidget)Wrap an ipywidget to be used inside Pluto.
JolinPluto.Setter — TypeSetter()
Setter("initial_value")Creates a pluto interactivity which separates the setter cell from the state cell.
Usage
set_a = Setter("initial_value")
# in another cell, extract the inner state from the setter
# such that updates will rerun this cell
a = @get set_a
# in yet another cell use `set_a`
set_a("new_value")
# or use a function syntax to easily access the previous value
set_a() do prev_a
"$prev_a!!"
endBase.get — Methodget(setter::Setter)Only works inside Jolin Pluto Notebook. Extracts the value from the Setter wrapper, making this very cell reactive so that as soon as the setter is called, this cell will rerun.
JolinPluto.ChannelPluto — Methodchannel = ChannelPluto(10) do ch
for i in 1:10
put!(ch, i)
sleep(1)
end
endLike normal Channel, with the underlying task being interrupted as soon as the Pluto cell is deleted.
JolinPluto.ChannelWithRepeatedFill — MethodChannelWithRepeatedFill(get_next_value, 2; sleep_seconds=1.0)Creates a ChannelPluto which calls get_next_value repeatedly, interleaved by calls to sleep of the given time (defaults to 0 seconds sleep).
JolinPluto.MD — MethodMD("# Markdown String")Markdown parser with special support for inline html fenced by <>...</>. As format_html returns single line html, this makes it possible to interpolate arbitrary html into markdown tables.
JolinPluto._split_macro_args — Methodseparates args and kwargs (kwargs are returned as Dict)
JolinPluto.authenticate_token — Functionauthenticate_token()
authenticate_token("exampleaudience")Creates a JSON Web Token which can be used for authentication at common cloud providers.
On cloud.jolin.io the token will be issued and signed by cloud.jolin.io, on Github Actions (used for automated tests), a respective github token is returned.
JolinPluto.cell_ids_create_wrapper — Methodcell_ids_wrapper = cell_ids_create_wrapper()Creates a wrapper around a Set of cell_ids so that they can be added (and removed) seamlessly and automatically from other cells.
Usage
cell_ids_wrapper = cell_ids_create_wrapper()
# in another cell access the cellids and e.g. print the url suffix
cell_ids = get(cell_ids_wrapper)
print(join("&isolated_cell_id=$id" for id in cell_ids))
# in yet another cell add its cell_id
cell_ids_push!(cell_ids_wrapper)JolinPluto.cell_ids_push! — Methodcell_ids_push!(cell_ids_wrapper)Adds the cell's cell-id to the given cellidswrapper. This automatically handles retriggering of cells as needed.
Also cleanup is handled, i.e. that the cell-id is removed again if this cell is deleted.
JolinPluto.clipboard_image_to_clipboard_html — Methodclipboardimagetoclipboardhtml()
Creates a little textfield where you can paste images. These images are then transformed to self-containing html img tags and copied back to the clipboard to be entered somewhere in Pluto.
JolinPluto.embedLargeHTML — MethodembedLargeHTML(html_string; width, height)For large HTML code a simple iframe is not enough. This function will help.
Example
JolinPluto.embedLargeHTML(read("figure.html", String); width="100%", height=400)JolinPluto.format_html — Methodformat_html(anything)Transform an object to raw html respresentation.
Note, this is a single line representation so that it can also be used inside Markdown Tables.
JolinPluto.is_running_in_jolinpluto_process — Methodis_running_in_pluto_process()This doesn't mean we're in a Pluto cell, e.g. can use @bind and hooks goodies. It only means PlutoRunner is available (and at a version that technically supports hooks)
JolinPluto.is_running_in_pluto_process — Methodis_running_in_pluto_process()This doesn't mean we're in a Pluto cell, e.g. can use @bind and hooks goodies. It only means PlutoRunner is available (and at a version that technically supports hooks)
JolinPluto.lang_enabled — Methodlang_enabled(Val(:py))Checks whether the language support is activated.
JolinPluto.lang_get_global — Functionlang_get_global(Val(:py), symbol)Gets the given variable from the respective language side.
JolinPluto.lang_set_global — Functionlang_set_global(Val(:py), symbol, value)Sets the given variable on the respective language side.
JolinPluto.output_below — Methodoutput_below()Reverse input output, first input then output. When removing the cell with @output_below, the order is reversed again.
JolinPluto.repeat_at — Methodrepeat_at(t -> (rand(), t), ceil(now(), Second(10)), init=:wait)
repeat_at(ceil(now(), Second(10)), init=:wait) do t
# code to be returned repeatedly
rand(), t
endWhen run inside Pluto it will rerun the function on the next specified time, again and again.
Keyword Arguments
initspecifies what to do at first run or re-evaluation caused by standard reactivity. You can specify any function (e.g.init=myinit_func)or one of the two special values:waitund:run.:wait(default) will wait for the next time and then run the code.:runwill run the code immediately without waiting.
JolinPluto.repeat_run — Functionrepeat_run(function_used_for_init_and_repeated_execution)
repeat_run(function_for_init, function_for_repetition)Repeat some long expression. It will run offline in a separate Task so that interactivity is preserved.
Optionally, specify another expression for initialization. Initialization will also be triggered if the cell is re-evaluated because some dependent cell or bond changed.
JolinPluto.repeat_take! — Methodnextvalue = repeat_take!(channel)This will repeatedly fetch for the next element from the given channel, re-evaluating the cell each time a new value arrives.
JolinPluto.viewof — Methodviewof(:symbol, element)
viewof("symbol", element)Return the HTML element, and use its latest JavaScript value as the definition of symbol.
Example
viewof(:x, html"<input type=range>")and in another cell:
x^2The first cell will show a slider as the cell's output, ranging from 0 until 100. The second cell will show the square of x, and is updated in real-time as the slider is moved.
JolinPluto.@Channel — Macrochannel = @Channel(10) do ch
for i in 1:10
put!(ch, i)
sleep(1)
end
endLike normal Channel, with the underlying task being interrupted as soon as the Pluto cell is deleted.
JolinPluto.@cell_ids_create_wrapper — Macrocell_ids_wrapper = @cell_ids_create_wrapper()Creates a wrapper around a Set of cell_ids so that they can be added (and removed) seamlessly and automatically from other cells.
Usage
cell_ids_wrapper = @cell_ids_create_wrapper()
# in another cell access the cellids and e.g. print the url suffix
cell_ids = @get cell_ids_wrapper
print(join("&isolated_cell_id=$id" for id in cell_ids))
# in yet another cell add its cell_id
@cell_ids_push! cell_ids_wrapperJolinPluto.@cell_ids_push! — Macro@cell_ids_push! cell_ids_wrapperAdds the cell's cell-id to the given cellidswrapper. This automatically handles retriggering of cells as needed.
Also cleanup is handled, i.e. that the cell-id is removed again if this cell is deleted.
JolinPluto.@get — Macro@get setterExtracts the value from the Setter wrapper, making this very cell reactive so that as soon as the setter is called, this cell will rerun.
JolinPluto.@repeat_at — Macro@repeat_at(ceil(now(), Second(10)), init=:wait) do t
# code to be returned repeatedly
rand(), t
end
@repeat_at(ceil(now(), Second(10)), init=:wait)When run inside Pluto it will rerun the function on the next specified time, again and again.
Keyword Arguments
initspecifies what to do at first run or re-evaluation caused by standard reactivity. You can specify any code or function call (e.g.init=nothing, orinit=myinit()). In addition there are two special values:waitund:run.:wait(default) will wait for the next time and then run the code.:runwill run the code immediately without waiting.
JolinPluto.@repeat_run — Macro@repeat_run(expr_used_for_init_and_repeated_execution)
@repeat_run(expr_for_init, expr_for_repetition)Repeat some long expression. It will run offline in a separate Task so that interactivity is preserved.
Optionally, specify another expression for initialization. Initialization will also be triggered if the cell is re-evaluated because some dependent cell or bond changed.
JolinPluto.@repeat_take! — Macronextvalue = @repeat_take! channelThis will repeatedly fetch for the next element from the given channel, re-evaluating the cell each time a new value arrives.