Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notebook shim version check #129

Merged
merged 1 commit into from
Jul 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions nbclassic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sys
from ._version import __version__
from ._version import __version__


# Packagers: modify this line if you store the notebook static files elsewhere
Expand All @@ -10,8 +10,9 @@
# Notebook shim to ensure notebook extensions backwards compatiblity.

try:
from notebook._version import __version__ as notebook_version
except Exception as e:
from notebook import version_info as notebook_version_info
except Exception:
notebook_version_info = None
# No notebook python package found.
# Shimming notebook to jupyter_server for notebook extensions backwards compatibility.
# We shim the complete notebook module.
Expand All @@ -22,10 +23,10 @@
handlers.IPythonHandler = handlers.JupyterHandler
notebook_handlers.IPythonHandler = handlers.JupyterHandler

if "notebook_version" in locals():
if notebook_version_info is not None:
# Notebook is available on the platform.
# We shim based on the notebook version.
if not notebook_version < "7":
if notebook_version_info >= (7,):
from .shim_notebook import shim_notebook
# Shimming existing notebook python package > 6 to jupyter_server.
# For notebook extensions backwards compatibility.
Expand Down