Skip to content

Commit

Permalink
ENH: Add check for sufficient notebook or jupyterlab version
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Apr 17, 2024
1 parent 212dd05 commit c4e8bb8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion itkwidgets/integrations/environment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from enum import Enum
from importlib import import_module
from packaging import version
import importlib_metadata
import sys


Expand Down Expand Up @@ -28,7 +30,6 @@ def find_env():
else:
return Env.SAGEMAKER
except:
import sys
if sys.platform == 'emscripten':
return Env.JUPYTERLITE
return Env.HYPHA
Expand All @@ -38,6 +39,15 @@ def find_env():

if ENVIRONMENT is not Env.JUPYTERLITE and ENVIRONMENT is not Env.HYPHA:
if ENVIRONMENT is not Env.COLAB:
if ENVIRONMENT is Env.JUPYTER_NOTEBOOK:
notebook_version = importlib_metadata.version('notebook')
if version.parse(notebook_version) < version.parse('7'):
raise RuntimeError('itkwidgets 1.0a51 and newer requires Jupyter notebook>=7.')
elif ENVIRONMENT is Env.JUPYTERLAB:
lab_version = importlib_metadata.version('jupyterlab')
if version.parse(lab_version) < version.parse('5'):
raise RuntimeError('itkwidgets 1.0a51 and newer requires jupyterlab>=4.')

try:
import_module("imjoy-jupyterlab-extension")
except ModuleNotFoundError:
Expand Down

0 comments on commit c4e8bb8

Please sign in to comment.