You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you're a developer of a `classic Notebook Server`_ extension, your extension should be able to work with *both* the classic notebook server and ``jupyter_server``.
410
+
411
+
There are a few key steps to make this happen:
412
+
413
+
1. Point Jupyter Server to the ``load_jupyter_server_extension`` function with a new reference name.
414
+
The ``load_jupyter_server_extension`` function was the key to loading a server extension in the classic Notebook Server. Jupyter Server expects the name of this function to be prefixed with an underscore—i.e. ``_load_jupyter_server_extension``. You can easily achieve this by adding a reference to the old function name with the new name in the same module.
415
+
416
+
.. code-block:: python
417
+
418
+
defload_jupyter_server_extension(nb_server_app):
419
+
...
420
+
421
+
# Reference the old function name with the new function name.
2. Add new data files to your extension package that enable it with Jupyter Server.
426
+
This new file can go next to your classic notebook server data files. Create a new sub-directory, ``jupyter_server_config.d``, and add a new ``.json`` file there:
427
+
428
+
.. raw:: html
429
+
430
+
<pre>
431
+
myextension
432
+
├── myextension/
433
+
│ ├── __init__.py
434
+
│ └── app.py
435
+
├── jupyter-config/
436
+
│ └── jupyter_notebook_config.d/
437
+
│ └── myextension.json
438
+
│ <b>└── jupyter_server_config.d/</b>
439
+
│ <b>└── myextension.json</b>
440
+
└── setup.py
441
+
</pre>
442
+
443
+
The new ``.json`` file should look something like this (you'll notice the changes in the configured class and trait names):
444
+
445
+
.. code-block:: json
446
+
447
+
{
448
+
"ServerApp": {
449
+
"jpserver_extensions": {
450
+
"myextension": true
451
+
}
452
+
}
453
+
}
454
+
455
+
Update your extension package's ``setup.py`` so that the data-files are moved into the jupyter configuration directories when users download the package.
3. (Optional) Point extension at the new favicon location.
479
+
The favicons in the Jupyter Notebook have been moved to a new location in Jupyter Server. If your extension is using one of these icons, you'll want to add a set of redirect handlers this. (In ``ExtensionApp``, this is handled automatically).
480
+
481
+
This usually means adding a chunk to your ``load_jupyter_server_extension`` function similar to this:
0 commit comments