Skip to content

Commit a852ea7

Browse files
authored
Merge pull request #835 from minrk/labextension-update
improve deprecation messaging around `ipcluster nbextension`
2 parents ebe4664 + 7a4a118 commit a852ea7

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

ipyparallel/cluster/app.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,13 @@ class IPClusterNBExtension(BaseParallelApplication):
627627

628628
name = 'ipcluster-nbextension'
629629

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
631637
632638
for Jupyter Notebook >= 4.2, you can use the new nbextension API:
633639
@@ -654,16 +660,36 @@ class IPClusterNBExtension(BaseParallelApplication):
654660
)
655661

656662
def start(self):
657-
from ipyparallel.nbextension.install import install_extensions
658-
659663
if len(self.extra_args) != 1:
660664
self.exit("Must specify 'enable' or 'disable'")
661665
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+
662688
if action == 'enable':
663-
print("Enabling IPython clusters tab")
689+
print("Enabling IPython clusters tab", file=sys.stderr)
664690
install_extensions(enable=True, user=self.user)
665691
elif action == 'disable':
666-
print("Disabling IPython clusters tab")
692+
print("Disabling IPython clusters tab", file=sys.stderr)
667693
install_extensions(enable=False, user=self.user)
668694
else:
669695
self.exit("Must specify 'enable' or 'disable', not '%s'" % action)

ipyparallel/nbextension/install.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
"""Install the IPython clusters tab in the Jupyter notebook dashboard"""
1+
"""Install the IPython clusters tab in the Jupyter notebook dashboard
2+
3+
Only applicable for notebook < 7
4+
"""
25
# Copyright (c) IPython Development Team.
36
# Distributed under the terms of the Modified BSD License.
47
from jupyter_core.paths import jupyter_config_dir

0 commit comments

Comments
 (0)