|
1 |
| -# jupyter_server_nbmodel |
| 1 | + |
| 2 | +[](https://datalayer.io) |
| 3 | + |
| 4 | +[](https://github.com/sponsors/datalayer) |
| 5 | + |
| 6 | +# 🪐 Jupyter Server NbModel |
2 | 7 |
|
3 | 8 | [](https://github.com/datalayer/jupyter-server-nbmodel/actions/workflows/build.yml)
|
4 | 9 | [](https://mybinder.org/v2/gh/datalayer/jupyter-server-nbmodel/main?urlpath=lab)
|
5 | 10 |
|
6 |
| -A Jupyter Server extension to execute code cell from the server. |
| 11 | +> Stop session timeouts and lost. |
| 12 | +
|
| 13 | +A Jupyter Server extension to execute code from the server-side NbModel. |
7 | 14 |
|
8 | 15 | This extension is composed of a Python package named `jupyter_server_nbmodel`
|
9 |
| -for the server extension and a NPM package named `jupyter-server-nbmodel` |
| 16 | +for the server extension and a NPM package named `@datalayer/jupyter-server-nbmodel` |
10 | 17 | for the frontend extension.
|
11 | 18 |
|
12 | 19 | ## Requirements
|
13 | 20 |
|
14 | 21 | - Jupyter Server
|
15 |
| -- \[recommended\] Real-time collaboration for JupyterLab/Notebook: |
| 22 | +- \[RECOMMENDED\] Real-time collaboration for JupyterLab/Notebook: |
16 | 23 | This will push the kernels results in the notebook from the server.
|
17 | 24 |
|
18 | 25 | ## Install
|
@@ -231,19 +238,29 @@ More information are provided within the [ui-tests](./ui-tests/README.md) README
|
231 | 238 |
|
232 | 239 | ```bash
|
233 | 240 | # Terminal 1.
|
| 241 | +# You can also invoke `make jupyter-server` |
234 | 242 | jupyter server --port 8888 --autoreload --ServerApp.disable_check_xsrf=True --IdentityProvider.token= --ServerApp.port_retries=0
|
| 243 | +``` |
235 | 244 |
|
| 245 | +```bash |
236 | 246 | # Terminal 2.
|
237 | 247 | KERNEL=$(curl -X POST http://localhost:8888/api/kernels)
|
238 | 248 | echo $KERNEL
|
| 249 | + |
239 | 250 | KERNEL_ID=$(echo $KERNEL | jq --raw-output '.id')
|
240 | 251 | echo $KERNEL_ID
|
241 |
| -REQUEST=$(curl --include http://localhost:8888/api/kernels/$KERNEL_ID/execute -d "{ \"code\": \"print('1+1')\" }") |
242 |
| -RESULT=$(echo $REQUEST | grep -i ^Location: | cut -d' ' -f2 | tr -d '\r') |
243 |
| -echo $RESULT |
244 | 252 |
|
245 |
| -curl http://localhost:8888$RESULT |
246 |
| -{"status": "ok", "execution_count": 1, "outputs": "[{\"output_type\": \"stream\", \"name\": \"stdout\", \"text\": \"1+1\\n\"}]"} |
| 253 | +RESPONSE=$(curl --include http://localhost:8888/api/kernels/$KERNEL_ID/execute -d "{ \"code\": \"print('1+1')\" }") |
| 254 | +echo $RESPONSE |
| 255 | + |
| 256 | +RESULT_PATH=$(echo $RESPONSE | grep -oP 'Location:\s*\K[^ ]+' | tr -d '\r\n') |
| 257 | +echo $RESULT_PATH |
| 258 | + |
| 259 | +URL="http://localhost:8888${RESULT_PATH}" |
| 260 | +echo $URL |
| 261 | + |
| 262 | +curl "$URL" |
| 263 | +# {"status": "ok", "execution_count": 1, "outputs": "[{\"output_type\": \"stream\", \"name\": \"stdout\", \"text\": \"1+1\\n\"}]"} |
247 | 264 | ```
|
248 | 265 |
|
249 | 266 | ### Running Tests
|
|
0 commit comments