Jupyterlab extension to show notebook cell completion browser notifications
Project description
jupyterlab-notifications
Notebook Cell Completion Notifications for JupyterLab.
Option to get notebook cell completion notifications via browser, slack, mobile, telegram, and many more!
Image of successful notebook cell execution browser notification
Image of failed notebook cell execution browser notification (Available only in >= v0.3.0)
Image of last selected notebook cell execution browser notification (Available only in >= v0.3.0)
Image of mobile phone notifications using ntfy
+ Pushover
Image of slack notification via ntfy + slack_webhook
Quick demos and tutorials :notebook:
To test out this extension without any local set-up, please check out the binder link. This will set-up the environment, install the extension, and take you to several demo notebooks for you to play around with to get familiar with the notifications extension.
In the tutorial
directory, there are several example notebooks you can use to test out the notifications extension.
- Notebooks with
py3_demo_
prefix - Minimal Python3 Notebooks to test out the extension. julia_demo.ipynb
- Minimal Julia Notebook to test out the extension. :warning: Note: Thetutorial/julia_demo.ipynb
will not work in the binder environment and will require additional set-up to test the Julia Notebook Kernel locally.
Compatible Versions and Requirements 🧰
jupyterlab-notifications |
jupyterlab |
Notebook Cell Timing Enabled |
Browser Requirements |
---|---|---|---|
>=0.3.0 |
>=3.1.0 |
Not required | Supports the Notification Web API* |
<0.3.0 |
>3.0.0 |
Required | Supports the Notification Web API* |
*For Notification Web API support, please check out Browser Compatibility Chart)
Install
For JupyterLab 3.x, the extension can be installed with pip
:
pip install jupyterlab-notifications
or conda
:
conda install -c conda-forge jupyterlab-notifications
Settings
Use the following settings to update cell execution time for a notification and information to display in the notification. (in Settings > Advanced Settings Editor
):
{
// Notifications
// jupyterlab-notifications:plugin
// Settings for the Notifications extension
// ****************************************
// Cell Number Type
// Type of cell number to display when the report_cell_number is true. Select from 'cell_index' or ‘cell_execution_count'.
cell_number_type: 'cell_index',
// Enabled Status
// Enable the extension or not.
enabled: true,
// Trigger only for the last selected notebook cell execution.
// Trigger a notification only for the last selected executed notebook cell.
// NOTE: Only Available in version >= v0.3.0
last_cell_only: false,
// Minimum Notebook Cell Execution Time
// The minimum execution time to send out notification for a particular notebook cell (in seconds).
minimum_cell_execution_time: 60,
// Notification Methods
// Option to send a notification with the specified method(s). The available options are 'browser' and 'ntfy'.
notification_methods: ['browser'],
// Report Notebook Cell Execution Time
// Display notebook cell execution time in the notification.
// If last_cell_only is set to true, the total duration of the selected cells will be displayed.
report_cell_execution_time: true,
// Report Notebook Cell Number
// Display notebook cell number in the notification.
report_cell_number: true
}
How to enable Notebook Cell Timing
:warning: For versions < 0.3.0
, Notebook Cell Timing needs to be enabled for Jupyterlab Notifications to work. Please go to Settings -> Advanced Settings Editor -> Notebook and update setting to:
{
// Recording timing
// Should timing data be recorded in cell metadata
recordTiming: true
}
The cell timing doesn't need to be enabled for Jupyterlab >= 3.1 and Jupyterlab notification version >= v0.3.0.
(Optional) Notifications using ntfy
You can recieve notifications via ntfy
.
ntfy 2.7.0 documentation https://ntfy.readthedocs.io/en/latest/
ntfy brings notification to your shell. It can automatically provide desktop notifications when long running code executions finish or it can send push notifications to your phone when a specific execution finishes.
How to enable notifications via ntfy
Install ntfy
.
$ pip install ntfy
You can find configuration instructions for different operating systems in the ntfy official configuration docs
For example, if you want to get notifications via the Pushover mobile app, make sure to create the configuration file in the right location and select pushover
for the backend.
$ vim ~/.config/ntfy/ntfy.yml # Linux
$ vim ~/Library/Application Support/ntfy/ntfy.yml # macOS
Note: You'll need to first install the Pushover mobile app and create an account to generate your user key.
backends:
- pushover
pushover:
user_key: YOUR_PUSHOVER_USER_KEY
Change the notifications settings. Append "ntfy"
into notification_methods
attribute.
- NOTE: The value
browser
implies default conventional method, which uses Webbrowser's Notification API.
{
// ...
notification_methods: ['browser', 'ntfy']
// ...
}
Contributing
Development install
Note: You will need NodeJS to build the extension package.
The jlpm
command is JupyterLab's pinned version of
yarn that is installed with JupyterLab. You may use
yarn
or npm
in lieu of jlpm
below.
# Clone the repo to your local environment
# Change directory to the jupyterlab-notifications directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jlpm run install:extension
# Rebuild extension Typescript source after making changes
jlpm run build
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
Uninstall
pip uninstall jupyterlab-notifications
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jupyterlab_notifications-0.5.0.tar.gz
.
File metadata
- Download URL: jupyterlab_notifications-0.5.0.tar.gz
- Upload date:
- Size: 8.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f161c7b2f7e93cd2a438feb66c06577b7b1b15ad7b16438a68e01b402c787f09 |
|
MD5 | a551d399b8a3cc8f9e66efde4c4f7b71 |
|
BLAKE2b-256 | b8e82ca1d70f03bcddd620933100950d156a38d5f82ea377e39625d6c68f7101 |
File details
Details for the file jupyterlab_notifications-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: jupyterlab_notifications-0.5.0-py3-none-any.whl
- Upload date:
- Size: 100.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c1716d24aac5e946b2e525fde7968df9d2a8f67c233ab7a036b6f5bc69bed2e |
|
MD5 | d80ab77596b4b1776cc0ec8398098ebc |
|
BLAKE2b-256 | 6424f14f0da14dd726f49076d59af3b9537254e83b2dc4fe0197d252bef300a5 |