Notebook Shim
Notebook-shim is a Python library that provides a compatibility layer for applications transitioning from `jupyter/notebook` to `jupyter/jupyter_server` as their backend. It specifically helps handle traits and configuration that moved between these two core Jupyter components. The current version is 0.2.4, and it is released on an as-needed basis to support the evolution of the Jupyter ecosystem.
Warnings
- breaking Direct inheritance from `notebook.notebookapp.NotebookApp` for server-side extensions is deprecated. You must migrate to `jupyter_server.serverapp.ServerApp` and use `notebook_shim.NotebookConfigShimMixin` for compatibility.
- gotcha The `notebook-shim` library is a compatibility layer, not a full replacement for `jupyter/notebook`. It's designed to ease the transition, but applications should aim for full `jupyter_server` compatibility over time.
- deprecated There is an open issue regarding the deprecation of `_jupyter_server_extension_paths` in `jupyter_server`, which might affect how extensions are discovered or loaded in the future.
Install
-
pip install notebook-shim
Imports
- NotebookConfigShimMixin
from notebook_shim import NotebookConfigShimMixin
Quickstart
from jupyter_server.serverapp import ServerApp
from notebook_shim import NotebookConfigShimMixin
class MyShimmedApp(NotebookConfigShimMixin, ServerApp):
# Your application's custom logic here
pass
if __name__ == '__main__':
# In a real application, you would run this via `jupyter-server` entrypoints.
# For a direct example, you can instantiate and start it minimally.
print("This example demonstrates the import path and class inheritance.")
print("To run a functional server, integrate MyShimmedApp with jupyter_server's extension system.")