@@ -627,7 +627,13 @@ class IPClusterNBExtension(BaseParallelApplication):
627
627
628
628
name = 'ipcluster-nbextension'
629
629
630
- description = """Enable/disable IPython clusters tab in Jupyter notebook
630
+ description = """(DEPRECATED) Enable/disable IPython clusters tab in classic Jupyter notebook
631
+
632
+ Only for the deprecated jupyter-notebook < 7.0.
633
+
634
+ For current jupyter-server implementations (jupyterlab and jupyter-notebook 7):
635
+
636
+ jupyter server extension enable ipyparallel
631
637
632
638
for Jupyter Notebook >= 4.2, you can use the new nbextension API:
633
639
@@ -654,16 +660,36 @@ class IPClusterNBExtension(BaseParallelApplication):
654
660
)
655
661
656
662
def start (self ):
657
- from ipyparallel .nbextension .install import install_extensions
658
-
659
663
if len (self .extra_args ) != 1 :
660
664
self .exit ("Must specify 'enable' or 'disable'" )
661
665
action = self .extra_args [0 ].lower ()
666
+
667
+ print (
668
+ "WARNING: `ipcluster nbextension` is deprecated. Use `jupyter server extension enable ipyparallel`" ,
669
+ file = sys .stderr ,
670
+ )
671
+
672
+ from ipyparallel .util import _v
673
+
674
+ try :
675
+ import notebook
676
+ except ImportError :
677
+ self .exit (
678
+ "Deprecated `ipcluster nbextension` requires `notebook<7`, no `notebook` package found."
679
+ )
680
+
681
+ if _v (notebook .__version__ ) >= _v ('7' ):
682
+ self .exit (
683
+ "Deprecated `ipcluster nbextension` requires `notebook<7`, found `notebook=={notebook.__version__}`."
684
+ )
685
+
686
+ from ipyparallel .nbextension .install import install_extensions
687
+
662
688
if action == 'enable' :
663
- print ("Enabling IPython clusters tab" )
689
+ print ("Enabling IPython clusters tab" , file = sys . stderr )
664
690
install_extensions (enable = True , user = self .user )
665
691
elif action == 'disable' :
666
- print ("Disabling IPython clusters tab" )
692
+ print ("Disabling IPython clusters tab" , file = sys . stderr )
667
693
install_extensions (enable = False , user = self .user )
668
694
else :
669
695
self .exit ("Must specify 'enable' or 'disable', not '%s'" % action )
0 commit comments