@@ -34,26 +34,27 @@ def notebook_is_running(runtime_dir=None):
34
34
35
35
def toggle_install (install , user = False , sys_prefix = False , overwrite = False ,
36
36
symlink = False , prefix = None , nbextensions_dir = None ,
37
- logger = None ):
37
+ logger = None , skip_running_check = False ):
38
38
"""Install or remove all jupyter_contrib_nbextensions files & config."""
39
- if notebook_is_running ():
39
+ if not skip_running_check and notebook_is_running ():
40
40
raise NotebookRunningError (
41
41
'Cannot configure while the Jupyter notebook server is running' )
42
42
_check_conflicting_kwargs (user = user , sys_prefix = sys_prefix , prefix = prefix ,
43
43
nbextensions_dir = nbextensions_dir )
44
44
toggle_install_files (
45
45
install , user = user , sys_prefix = sys_prefix , overwrite = overwrite ,
46
46
symlink = symlink , prefix = prefix , nbextensions_dir = nbextensions_dir ,
47
- logger = logger )
47
+ logger = logger , skip_running_check = skip_running_check )
48
48
toggle_install_config (
49
- install , user = user , sys_prefix = sys_prefix , logger = logger )
49
+ install , user = user , sys_prefix = sys_prefix , logger = logger ,
50
+ skip_running_check = skip_running_check )
50
51
51
52
52
53
def toggle_install_files (install , user = False , sys_prefix = False , logger = None ,
53
54
overwrite = False , symlink = False , prefix = None ,
54
- nbextensions_dir = None ):
55
+ nbextensions_dir = None , skip_running_check = False ):
55
56
"""Install/remove jupyter_contrib_nbextensions files."""
56
- if notebook_is_running ():
57
+ if not skip_running_check and notebook_is_running ():
57
58
raise NotebookRunningError (
58
59
'Cannot configure while the Jupyter notebook server is running' )
59
60
kwargs = dict (user = user , sys_prefix = sys_prefix , prefix = prefix ,
@@ -79,9 +80,10 @@ def toggle_install_files(install, user=False, sys_prefix=False, logger=None,
79
80
nbextensions .uninstall_nbextension_python (mod .__name__ , ** kwargs )
80
81
81
82
82
- def toggle_install_config (install , user = False , sys_prefix = False , logger = None ):
83
+ def toggle_install_config (install , user = False , sys_prefix = False ,
84
+ skip_running_check = False , logger = None ):
83
85
"""Install/remove contrib nbextensions to/from jupyter_nbconvert_config."""
84
- if notebook_is_running ():
86
+ if not skip_running_check and notebook_is_running ():
85
87
raise NotebookRunningError (
86
88
'Cannot configure while the Jupyter notebook server is running' )
87
89
_check_conflicting_kwargs (user = user , sys_prefix = sys_prefix )
@@ -146,20 +148,23 @@ def toggle_install_config(install, user=False, sys_prefix=False, logger=None):
146
148
147
149
148
150
def install (user = False , sys_prefix = False , prefix = None , nbextensions_dir = None ,
149
- logger = None , overwrite = False , symlink = False ):
151
+ logger = None , overwrite = False , symlink = False ,
152
+ skip_running_check = False ):
150
153
"""Install all jupyter_contrib_nbextensions files & config."""
151
154
return toggle_install (
152
155
True , user = user , sys_prefix = sys_prefix , prefix = prefix ,
153
156
nbextensions_dir = nbextensions_dir , logger = logger ,
154
- overwrite = overwrite , symlink = symlink )
157
+ overwrite = overwrite , symlink = symlink ,
158
+ skip_running_check = skip_running_check )
155
159
156
160
157
161
def uninstall (user = False , sys_prefix = False , prefix = None , nbextensions_dir = None ,
158
- logger = None ):
162
+ logger = None , skip_running_check = False ):
159
163
"""Uninstall all jupyter_contrib_nbextensions files & config."""
160
164
return toggle_install (
161
165
False , user = user , sys_prefix = sys_prefix , prefix = prefix ,
162
- nbextensions_dir = nbextensions_dir , logger = logger )
166
+ nbextensions_dir = nbextensions_dir , logger = logger ,
167
+ skip_running_check = skip_running_check )
163
168
164
169
# -----------------------------------------------------------------------------
165
170
# Private API
0 commit comments