npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

jupyterlab_notifications_extension

v1.1.26

Published

Jupyterlab extension to receive and display notifications in the main panel. Those can be from the jupyterjub administrator or from other places.

Readme

jupyterlab_notifications_extension

GitHub Actions npm version PyPI version Total PyPI downloads JupyterLab 4

JupyterLab extension for sending notifications using the native JupyterLab notification system. External systems and extensions send alerts and status updates that appear in JupyterLab's notification center.

This extension serves as the notification backbone for Stellars JupyterHub Platform for Data Science, allowing administrators to broadcast notification messages to all running JupyterLab servers.

Five notification types with distinct visual styling provide clear status communication:

Notification Types

Access via command palette for quick manual notification sending:

Command Palette

Interactive dialog with message input, type selection, auto-close timing, and action button options:

Send Dialog

Key Features:

  • REST API for external systems to POST notifications with authentication
  • Command palette integration with interactive dialog
  • Programmatic command API for extensions and automation
  • Five notification types (info, success, warning, error, in-progress)
  • Configurable auto-close with millisecond precision or manual dismiss
  • Optional action buttons (currently dismiss only)
  • Broadcast delivery via 30-second polling
  • In-memory queue cleared after delivery

Installation

pip install jupyterlab_notifications_extension

Requirements: JupyterLab >= 4.0.0

API Reference

POST /jupyterlab-notifications-extension/ingest

Send notifications to JupyterLab. Requires authentication via Authorization: token <TOKEN> header or ?token=<TOKEN> query parameter. Requests from localhost (127.0.0.1, ::1) skip authentication.

Endpoint: POST /jupyterlab-notifications-extension/ingest

Request Body (application/json):

{
  "message": "Your notification message",
  "type": "info",
  "autoClose": 5000,
  "actions": [
    {
      "label": "Click here",
      "caption": "Additional info",
      "displayType": "accent"
    }
  ]
}

Request Parameters:

| Field | Type | Required | Default | Description | | ----------- | -------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | | message | string | Yes | - | Notification text (max 140 characters) | | type | string | No | "info" | Visual style: default, info, success, warning, error, in-progress | | autoClose | number/boolean | No | 5000 | Milliseconds before auto-dismiss. false = manual dismiss only. 0 = silent mode (notification center only, no toast) | | actions | array | No | [] | Action buttons (see below) |

Action Button Schema:

| Field | Type | Required | Default | Description | | ------------- | ------ | -------- | ----------- | ------------------------------------------------- | | label | string | Yes | - | Button text | | caption | string | No | "" | Tooltip text | | displayType | string | No | "default" | Visual style: default, accent, warn, link |

Note: Action buttons are purely visual. Clicking any button dismisses the notification using JupyterLab's native behavior. Buttons do not trigger custom callbacks or actions.

Response (200 OK):

{
  "success": true,
  "notification_id": "notif_1762549476180_0"
}

Error Responses:

  • 400 Bad Request - Missing message field or invalid JSON
  • 401 Unauthorized - Missing or invalid authentication token
  • 500 Internal Server Error - Server-side processing error

Usage Examples

From JupyterLab Extensions

Send notifications programmatically from other extensions:

// Basic notification
await app.commands.execute('jupyterlab-notifications:send', {
  message: 'Operation complete'
});

// Custom type and auto-close
await app.commands.execute('jupyterlab-notifications:send', {
  message: 'Build finished successfully',
  type: 'success',
  autoClose: 3000
});

// With action button
await app.commands.execute('jupyterlab-notifications:send', {
  message: 'Error processing data',
  type: 'error',
  autoClose: false,
  actions: [{ label: 'View Details', displayType: 'accent' }]
});

CLI Tool

The jupyterlab-notify command is installed with the extension:

# Basic notification (auto-detects URL from running servers)
jupyterlab-notify -m "Deployment complete" -t success
# Output: URL: http://127.0.0.1:8888/jupyterhub/user/alice | Type: success
#         Notification sent: notif_1765552893662_0

# With explicit URL (e.g., JupyterHub)
jupyterlab-notify --url "http://127.0.0.1:8888/jupyterhub/user/alice" -m "Hello"

# Persistent warning (no auto-close)
jupyterlab-notify -m "System maintenance in 1 hour" -t warning --no-auto-close

# Silent mode (notification center only, no toast)
jupyterlab-notify -m "Background task finished" --auto-close 0

URL auto-detection: Queries jupyter server list --json to find running servers and constructs localhost URL. Falls back to JUPYTERHUB_SERVICE_PREFIX environment variable or localhost:8888.

cURL

# Localhost - no authentication required
curl -X POST http://localhost:8888/jupyterlab-notifications-extension/ingest \
  -H "Content-Type: application/json" \
  -d '{"message": "Build completed", "type": "success"}'

# Localhost - warning that stays until dismissed
curl -X POST http://localhost:8888/jupyterlab-notifications-extension/ingest \
  -H "Content-Type: application/json" \
  -d '{"message": "System maintenance in 1 hour", "type": "warning", "autoClose": false}'

# Remote - requires authentication token
curl -X POST http://jupyterhub.example.com/user/alice/jupyterlab-notifications-extension/ingest \
  -H "Content-Type: application/json" \
  -H "Authorization: token YOUR_JUPYTER_TOKEN" \
  -d '{"message": "Deployment complete", "type": "info"}'

Architecture

Broadcast-only model - all notifications delivered to the JupyterLab server.

Flow: External system POSTs to /jupyterlab-notifications-extension/ingest -> Server queues in memory -> Frontend polls /jupyterlab-notifications-extension/notifications every 30 seconds -> Displays via JupyterLab notification manager -> Clears queue after fetch.

Troubleshooting

Frontend installed but not working:

jupyter server extension list  # Verify server extension enabled

Server extension enabled but frontend missing:

jupyter labextension list  # Verify frontend extension installed

Notifications not appearing: Check browser console for polling errors or verify JupyterLab was restarted after installation.

Uninstall

pip uninstall jupyterlab_notifications_extension

Development

Setup

Requires NodeJS to build the extension. Uses jlpm (JupyterLab's pinned yarn) for package management.

# Install in development mode
python -m venv .venv
source .venv/bin/activate
pip install --editable ".[dev,test]"

# Link extension with JupyterLab
jupyter labextension develop . --overwrite
jupyter server extension enable jupyterlab_notifications_extension

# Build TypeScript
jlpm build

Development workflow

Run jlpm watch in one terminal to auto-rebuild on changes, and jupyter lab in another. Refresh browser after rebuilds to load changes.

jlpm watch           # Auto-rebuild on file changes
jupyter lab          # Run JupyterLab

Cleanup

jupyter server extension disable jupyterlab_notifications_extension
pip uninstall jupyterlab_notifications_extension
# Remove symlink: find via `jupyter labextension list`

Testing

Python tests (Pytest):

pip install -e ".[test]"
pytest -vv -r ap --cov jupyterlab_notifications_extension

Frontend tests (Jest):

jlpm test

Integration tests (Playwright/Galata): See ui-tests/README.md

Packaging

See RELEASE.md for release procedures.