Registry / web-framework / notebook-shim

notebook-shim

JSON →
library0.2.4pypypi✓ verified 24d ago

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.

pip install notebook-shim
INSTALL
IMPORT
SIG · NOTEBOOK-SHIM
N
notebook-shim
web-frameworkpythonv0.2.4
Install
8.2s avg
Import
7663ms
Disk
68MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 7.918s · 68.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 8.2s · import 7.408s · 65MB
68MB installed
● package 68MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NotebookConfigShimMixin
from notebook_shim.shim import NotebookConfigShimMixin
from notebook_shim import NotebookConfigShimMixin

This quickstart demonstrates the primary use case of `notebook-shim`: integrating `NotebookConfigShimMixin` into an application that now extends `jupyter_server.serverapp.ServerApp` instead of the legacy `notebook.notebookapp.NotebookApp`.

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.")
Debug
Known issues
breakingDirect 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.
fix
Ensure `notebook-shim` is installed (e.g., `pip install notebook-shim`). Then, import `NotebookConfigShimMixin` from its specific submodule, typically `from notebook_shim.notebook.mixins import NotebookConfigShimMixin`, and include it in your application's inheritance list: `class MyExtension(NotebookConfigShimMixin, ServerApp):`.
affects: All versions when migrating from `jupyter/notebook` to `jupyter/jupyter_server`.
gotchaThe `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.
fix
Refer to the `jupyter_server` documentation for best practices on developing extensions and applications natively against `jupyter_server`.
affects: All versions
deprecatedThere 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.
fix
Monitor the `jupyter/notebook_shim` and `jupyter/jupyter_server` GitHub repositories for updates on extension path discovery mechanisms and adapt your extension registration accordingly.
affects: Potentially future versions of `jupyter_server` and `notebook-shim`.
breakingThe `NotebookConfigShimMixin` class could not be imported from the `notebook_shim` package. This typically indicates that `notebook_shim` is either not installed, or an incompatible version is installed. `NotebookConfigShimMixin` was introduced in `notebook-shim` version 0.2.0.
fix
Ensure `notebook_shim` is installed and updated to at least version 0.2.0 or higher. For example: `pip install 'notebook-shim>=0.2.0'`.
affects: All versions where `notebook-shim` is not installed or is older than 0.2.0.
Upgrade
Version history
0.2.4latest on PyPI · released Feb 14, 2024
Audit
Dependencies
jupyter_serverrequiredProvides the core backend services and APIs that `notebook-shim` facilitates the transition to.
traitletsrequiredUsed for the configuration system and the `NotebookConfigShimMixin` functionality.
Agent activity
5 hits · last 30 days
node
4
Resources
notebook-shim — pip install notebook-shim · libregistry