This code will import the notebook module and display the paths that Juypter will search for NBExtensions
In [ ]:
import notebook
from __future__ import print_function
from jupyter_core.paths import jupyter_data_dir, jupyter_path
print(jupyter_data_dir())
print(jupyter_path())
The ! below is a "magic" that runs os commands. The command below assumes your cuurent working directory is inside the sas_kernel cloned repository. If that is not the case then you can either:
! to change the current working directoryIf this command is successful you should see a note about files being copied from the sas_kernel location to /usr/local/share/jupyter/nbextensions/
In [ ]:
! sudo jupyter nbextension install sas_kernel/sas_kernel/nbextensions/showSASLog
This python code will check on the nbextension in systemwide folders (user=False is the flag for this)
and then enable the extension. If anything goes wrong, you'll see the Extension not found message
In [ ]:
if notebook.nbextensions.check_nbextension('showSASLog', user=False):
E = notebook.nbextensions.EnableNBExtensionApp()
E.enable_nbextension('showSASLog/main')
else:
print ("Extension not found")
In [ ]:
! sudo jupyter nbextension install /root/sas_kernel/sas_kernel/nbextensions/theme
In [ ]:
if notebook.nbextensions.check_nbextension('theme', user=False):
E = notebook.nbextensions.EnableNBExtensionApp()
E.enable_nbextension('theme/theme_selector')
else:
print ("Extension not found")
The ! below is a "magic" that runs os commands. The command below assumes your cuurent working directory is inside the sas_kernel cloned repository. If that is not the case then you can either:
! to change the current working directoryIf this command is successful you should see a note about files being copied from the sas_kernel location to /usr/local/share/jupyter/nbextensions/
In [ ]:
! jupyter nbextension install sas_kernel/sas_kernel/nbextensions/showSASLog --user
This python code will check on the nbextension in user folders ~/ (user=True is the flag for this)
and then enable the extension. If anything goes wrong, you'll see the Extension not found message
In [ ]:
if notebook.nbextensions.check_nbextension('showSASLog', user=True):
E = notebook.nbextensions.EnableNBExtensionApp()
E.enable_nbextension('showSASLog/main')
else:
print ("Extension not found")
In [ ]:
! jupyter nbextension install /root/sas_kernel/sas_kernel/nbextensions/theme --user
In [ ]:
if notebook.nbextensions.check_nbextension('theme', user=True):
E = notebook.nbextensions.EnableNBExtensionApp()
E.enable_nbextension('theme/theme_selector')
else:
print ("Extension not found")
In [ ]:
from notebook.services.config import ConfigManager
from IPython.display import HTML
ip = get_ipython()
cm = ConfigManager(parent=ip, profile_dir=ip.profile_dir.location)
extensions =cm.get('notebook')
table = ""
for ext in extensions['load_extensions']:
table += "<tr><td>%s</td>\n" % (ext)
top = """
<table border="1">
<tr>
<th>Extension name</th>
</tr>
"""
bottom = """
</table>
"""
HTML(top + table + bottom)