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.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swannotificationsservice-1.0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for swannotificationsservice-1.0.2.tar.gz
Algorithm Hash digest
SHA256 79a5f1e139e983b93e2d5e11f5f651ff813cd35eacb5f4b9f320271c3cb822b1
MD5 957696b9ce9f80bf1b710f6d93ee0966
BLAKE2b-256 855bde00a20d4e229c4ed753131fb722c5e9d7e776e4c9c37c75adcb4349c5fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for swannotificationsservice-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a95ff6c09d76c674ecbdc6ba56400f981940126d0fdda75570e56ff746e25c48
MD5 3e087b9784f9c993689dfdd18d716eb2
BLAKE2b-256 159097ed64c87092f1ddf28490993f69add8ca7570f3620cf7a4628da3fda1d8

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