Skip to main content

JupyterHub service to expose notifications for Jupyter

Project description

SwanNotificationsService

JupyterHub service that exposes an API with notifications for the logged in user. The notifications are specified in a json file. If a "maintenance file" exists, a notification will be given that the service is under maintenance.

This extension works in conjunction with SwanNotifications.

Requirements

This module requires and installs JupyterHub.

Installation

Install the package:

pip install swannotificationsservice

Update the container image

This folder contains a Dockerfile that can be used to create an image for the pod that runs the notifications service. Once you release to PyPI you need to create a new image, e.g.

docker build -t gitlab-registry.cern.ch/swan/docker-images/jupyterhub/notifications:v0.1.0 && docker push gitlab-registry.cern.ch/swan/docker-images/jupyterhub/notifications:v0.1.0

Usage

Call the binary and specify configuration parameters:

swannotificationsservice --notifications_file /srv/jupyterhub/notifications.json

Configuration parameters:

  • port (default: 8888)
  • notifications_file (default: /srv/jupyterhub/notifications.json)
  • maintenance_file (default: /etc/nologin)
  • prefix (default: /)

Notifications file example:

[
    {
        "user": "*",
        "id": "notif1",
        "level": "info",
        "dismissible": 0,
        "message": "This is a notification"
    }
]

Explanation:

  • user: username or '*' for all users;
  • id: unique identifier;
  • level: type of the notification (notice, info, success, or error)
  • dismissible: wether the user will be able to permanently hide the notification (0 or 1)
  • message: the text/html message

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

swannotificationsservice-1.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

swannotificationsservice-1.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file swannotificationsservice-1.0.1.tar.gz.

File metadata

File hashes

Hashes for swannotificationsservice-1.0.1.tar.gz
Algorithm Hash digest
SHA256 43d59902ebbee7e05628a256219e4f9b07a65a7d04a6a80137a78b90f8d21ff8
MD5 44dccf69bb118b3273a6eaa840c0ea0c
BLAKE2b-256 9f9d0b6df87cc00f174671af49c2b6c46c520781d720e5e902ae8ed6e117c23a

See more details on using hashes here.

File details

Details for the file swannotificationsservice-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for swannotificationsservice-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56620cf51c28b5f13789a08807fa13b5691be35bee1e91ba7d4877efd7650aa2
MD5 13b8084db923bd4ab7dd24e1bcd275b2
BLAKE2b-256 c394ea6ebc72602fc3bb9a569e709679bfcdaa244cae3e409730322c9263a97a

See more details on using hashes here.

Supported by

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