Skip to main content

IPython/Jupyter notebook magic to notify the programmer when a line/cell has completed execution

Project description

About

IPython Bell is a simple magic for IPython and Jupyter Notebooks, which notifies yoy when the current line/cell has finished execution. This is particularly useful for long tasks. It can make sounds or even make notification bubbles pop up.

Installation

IPython bell can be installed as a standard Python package: either from PyPI:

pip install IPythonBell

or from git:

git clone http://github.com/samwhitehall/ipython-bell.git
cd ipython-bell/
python setup.py install

This can be imported into an IPython shell session using either: import ipython_bell or %load_ext ipython_bell

Although you probably want it to load when IPython loads, in which case, edit your IPython profile file (by default ~/.ipython/profile_default/ipython_config.py) and add ipython_bell to :

c.TerminalIPythonApp.extensions = [
    'ipython_bell'
]

(you may need to create this, and can do so with ipython profile create).

Usage

This can be used as a magic for a single line (line magic):

In [1]: %bell print 'hello'
hello

or across multiple lines (cell magic):

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

There are four currently available notifiers, selectable with the -n or --notifier arguments:

  • Terminal Bell term: prints an audible bell character to stdout (doesn’t work in Notebook).

  • Say say: play a system sound & use text-to-speech.

  • Notification notify: (default) operating system notification with sound.

  • Silent Notification notify-silent: operating notification without sound

Specified as follows (in this case, for notify):

In [1]: %bell -n notify print 'hello'
hello

In[2]: %%bell -n notify
import time
time.sleep(5)

Compatibility

  • MacOS: should work out of the box.

  • Linux: you may need to install beep and/or libnotify.

  • Windows: entirely untested, so please create an issue if it doesn’t work (notifications only designed to work work on Windows 10+).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

IPythonBell-0.10.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file IPythonBell-0.10.tar.gz.

File metadata

  • Download URL: IPythonBell-0.10.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for IPythonBell-0.10.tar.gz
Algorithm Hash digest
SHA256 c22c8c779fcf1b76cacd3511a7a96f5c3cff7a5695b9bc1099019ae210f9ad55
MD5 1827ff1d3cbc836c995c6cabea8164b4
BLAKE2b-256 f37721c2fd505d43ef0b3713fa6f187f7eef3350d3f3e54617e81d972967ad8f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page