jupyter-notify Test Notebook

Test the basic functionality:


In [ ]:
import jupyternotify
ip = get_ipython()
ip.register_magics(jupyternotify.JupyterNotifyMagics)

In [ ]:
%%notify
import time
time.sleep(5)

Test the require_interaction option for stickiness:


In [ ]:
import jupyternotify
ip = get_ipython()
ip.register_magics(jupyternotify.JupyterNotifyMagics(
    ip,
    require_interaction=True
))

In [ ]:
%%notify
import time
time.sleep(5)

Test custom messages:


In [ ]:
import jupyternotify
ip = get_ipython()
ip.register_magics(jupyternotify.JupyterNotifyMagics)

In [ ]:
%%notify -m "Slept for 5 seconds."
import time
time.sleep(5)

Test the mid-cell line magic:


In [ ]:
import time
time.sleep(5)
%notify -m "Slept for 5 seconds."
time.sleep(6)
%notify -m "Slept for 6 seconds."
time.sleep(2)

Test the autonotify line magic:


In [ ]:
import numpy as np
import time
# autonotify on completion for cells that run longer than 30 seconds
%autonotify -a 30

In [ ]:
# no notification
time.sleep(29)

In [ ]:
# sends notification on finish
time.sleep(31)

Test the option to use the last line of cell output as the message:


In [ ]:
%%notify -o
answer = 42
'The answer is {}.'.format(answer)

In [ ]: