jupyterlab_notifications_extension 1.1.21 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +36 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -128,44 +128,58 @@ await app.commands.execute('jupyterlab-notifications:send', {
128
128
  });
129
129
  ```
130
130
 
131
- ### Python Script
131
+ ### CLI Tool
132
132
 
133
- The included script auto-detects tokens from `JUPYTERHUB_API_TOKEN`, `JPY_API_TOKEN`, or `JUPYTER_TOKEN` environment variables:
133
+ The `jupyter-notify` command is installed with the extension:
134
134
 
135
135
  ```bash
136
- # Basic notification
137
- ./scripts/send_notification.py --message "Deployment complete" --type success
136
+ # Local mode (default) - adds directly to notification store
137
+ jupyter-notify -m "Deployment complete" -t success
138
+ # Output: Mode: Local | Type: success
139
+ # Notification queued: notif_1765552888047_0
140
+
141
+ # API mode - auto-detects URL from environment
142
+ jupyter-notify --use-api -m "Build finished"
143
+ # Output: Mode: API | URL: http://127.0.0.1:8888/jupyterhub/user/alice | Type: info
144
+ # Notification sent: notif_1765552893662_0
145
+
146
+ # API mode with explicit URL (--url implies --use-api)
147
+ jupyter-notify --url "http://127.0.0.1:8888/jupyterhub/user/alice" -m "Hello"
138
148
 
139
149
  # Persistent warning (no auto-close)
140
- ./scripts/send_notification.py --message "System maintenance in 1 hour" --type warning --no-auto-close
150
+ jupyter-notify -m "System maintenance in 1 hour" -t warning --no-auto-close
141
151
 
142
- # Silent mode (notification center only)
143
- ./scripts/send_notification.py --message "Background task finished" --auto-close 0
152
+ # Silent mode (notification center only, no toast)
153
+ jupyter-notify -m "Background task finished" --auto-close 0
144
154
  ```
145
155
 
156
+ **Modes**:
157
+ - **Local** (default): Adds notifications directly to the in-memory store. Works when running in the same Python environment as JupyterLab (e.g., from a notebook terminal)
158
+ - **API** (`--use-api` or `--url`): Sends via HTTP. Use for remote servers or when running outside JupyterLab's process
159
+
160
+ **Environment variables** (for API mode URL auto-detection):
161
+ - `JUPYTER_SERVER_URL` - explicit server URL
162
+ - `JUPYTERHUB_SERVICE_PREFIX` - JupyterHub user path (e.g., `/jupyterhub/user/alice`)
163
+ - `JUPYTER_PORT` - server port (default: 8888)
164
+
146
165
  ### cURL
147
166
 
148
167
  ```bash
149
- # Basic info notification
168
+ # Localhost - no authentication required
150
169
  curl -X POST http://localhost:8888/jupyterlab-notifications-extension/ingest \
151
170
  -H "Content-Type: application/json" \
152
- -H "Authorization: token YOUR_TOKEN" \
153
- -d '{"message": "Build completed", "type": "info"}'
171
+ -d '{"message": "Build completed", "type": "success"}'
154
172
 
155
- # Error notification with action button
173
+ # Localhost - warning that stays until dismissed
156
174
  curl -X POST http://localhost:8888/jupyterlab-notifications-extension/ingest \
157
175
  -H "Content-Type: application/json" \
158
- -H "Authorization: token YOUR_TOKEN" \
159
- -d '{
160
- "message": "Build failed on main branch",
161
- "type": "error",
162
- "autoClose": false,
163
- "actions": [{
164
- "label": "View Logs",
165
- "caption": "Open build logs",
166
- "displayType": "accent"
167
- }]
168
- }'
176
+ -d '{"message": "System maintenance in 1 hour", "type": "warning", "autoClose": false}'
177
+
178
+ # Remote - requires authentication token
179
+ curl -X POST http://jupyterhub.example.com/user/alice/jupyterlab-notifications-extension/ingest \
180
+ -H "Content-Type: application/json" \
181
+ -H "Authorization: token YOUR_JUPYTER_TOKEN" \
182
+ -d '{"message": "Deployment complete", "type": "info"}'
169
183
  ```
170
184
 
171
185
  ## Architecture
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyterlab_notifications_extension",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "Jupyterlab extension to receive and display notifications in the main panel. Those can be from the jupyterjub administrator or from other places.",
5
5
  "keywords": [
6
6
  "jupyter",