# 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](https://github.com/swan-cern/jupyter-extensions/tree/master/SwanNotifications).
## Requirements
This module requires and installs JupyterHub.
## Installation
Install the package:
```bash
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.
```bash
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:
```bash
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:
```json
[
{
"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
Raw data
{
"_id": null,
"home_page": "https://github.com/swan-cern/jupyterhub-extensions",
"name": "swannotificationsservice",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "JupyterHub, SWAN, CERN",
"author": "SWAN Admins",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9f/9d/0b6df87cc00f174671af49c2b6c46c520781d720e5e902ae8ed6e117c23a/swannotificationsservice-1.0.1.tar.gz",
"platform": "Linux",
"description": "# SwanNotificationsService\n\nJupyterHub service that exposes an API with notifications for the logged in user.\nThe notifications are specified in a json file. If a \"maintenance file\" exists, a notification will be given that the service is under maintenance.\n\nThis extension works in conjunction with [SwanNotifications](https://github.com/swan-cern/jupyter-extensions/tree/master/SwanNotifications).\n\n## Requirements\n\nThis module requires and installs JupyterHub.\n\n## Installation\n\nInstall the package:\n\n```bash\npip install swannotificationsservice\n```\n\n## Update the container image\n\nThis 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.\n\n```bash\ndocker 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\n```\n\n## Usage\n\nCall the binary and specify configuration parameters:\n```bash\nswannotificationsservice --notifications_file /srv/jupyterhub/notifications.json\n```\n\nConfiguration parameters:\n\n* port (default: 8888)\n* notifications_file (default: /srv/jupyterhub/notifications.json)\n* maintenance_file (default: /etc/nologin)\n* prefix (default: /)\n\nNotifications file example:\n\n```json\n[\n {\n \"user\": \"*\",\n \"id\": \"notif1\",\n \"level\": \"info\",\n \"dismissible\": 0,\n \"message\": \"This is a notification\"\n }\n]\n```\n\nExplanation:\n* user: username or '*' for all users;\n* id: unique identifier;\n* level: type of the notification (notice, info, success, or error)\n* dismissible: wether the user will be able to permanently hide the notification (0 or 1)\n* message: the text/html message\n",
"bugtrack_url": null,
"license": "AGPL-3.0",
"summary": "JupyterHub service to expose notifications for Jupyter",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/swan-cern/jupyterhub-extensions"
},
"split_keywords": [
"jupyterhub",
" swan",
" cern"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c394ea6ebc72602fc3bb9a569e709679bfcdaa244cae3e409730322c9263a97a",
"md5": "13b8084db923bd4ab7dd24e1bcd275b2",
"sha256": "56620cf51c28b5f13789a08807fa13b5691be35bee1e91ba7d4877efd7650aa2"
},
"downloads": -1,
"filename": "swannotificationsservice-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "13b8084db923bd4ab7dd24e1bcd275b2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4995,
"upload_time": "2024-08-28T12:15:20",
"upload_time_iso_8601": "2024-08-28T12:15:20.560983Z",
"url": "https://files.pythonhosted.org/packages/c3/94/ea6ebc72602fc3bb9a569e709679bfcdaa244cae3e409730322c9263a97a/swannotificationsservice-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f9d0b6df87cc00f174671af49c2b6c46c520781d720e5e902ae8ed6e117c23a",
"md5": "44dccf69bb118b3273a6eaa840c0ea0c",
"sha256": "43d59902ebbee7e05628a256219e4f9b07a65a7d04a6a80137a78b90f8d21ff8"
},
"downloads": -1,
"filename": "swannotificationsservice-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "44dccf69bb118b3273a6eaa840c0ea0c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4165,
"upload_time": "2024-08-28T12:15:21",
"upload_time_iso_8601": "2024-08-28T12:15:21.365911Z",
"url": "https://files.pythonhosted.org/packages/9f/9d/0b6df87cc00f174671af49c2b6c46c520781d720e5e902ae8ed6e117c23a/swannotificationsservice-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-28 12:15:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "swan-cern",
"github_project": "jupyterhub-extensions",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "swannotificationsservice"
}