def _install_js(): install_nbextension(EXT_DIR, overwrite=True, user=True, verbose=2) cm = ConfigManager() print('Enabling extension for notebook') cm.update("notebook", {"load_extensions": {"nbexamples/submit-example-button": True}}) cm.update("tree", {"load_extensions": {"nbexamples/main": True}})
def customize_settings(): from IPython.display import display, HTML from IPython.html.services.config import ConfigManager from IPython.utils.path import locate_profile cm = ConfigManager(profile_dir=locate_profile(get_ipython().profile)) cm.update('livereveal', {'width': 1024,'height': 768,}) display(HTML(open("notebook_style.css").read()))
def _install_js(): install_nbextension(EXT_DIR, destination='nbshared', overwrite=True, user=True, verbose=2) cm = ConfigManager() print('Enabling extension for notebook') cm.update("notebook", {"load_extensions": {"nbshared/submit-shared-button": True}}) cm.update("tree", {"load_extensions": {"nbshared/main": True}})
def customize_settings(): from IPython.display import display, HTML from IPython.html.services.config import ConfigManager from IPython.utils.path import locate_profile cm = ConfigManager(profile_dir=locate_profile(get_ipython().profile)) cm.update('livereveal', { 'width': 1024, 'height': 768, }) display(HTML(open("notebook_style.css").read()))
def install(extension, use_symlink=False, profile='default', enable=True): # Install the livereveal code. ext_dir = os.path.join(base_dir, extension) install_nbextension(ext_dir, symlink=use_symlink, overwrite=use_symlink, user=True) # Enable/Disable the extension in the given profile. profile_dir = locate_profile(profile) cm = ConfigManager(profile_dir=profile_dir) cm.update('notebook', {"load_extensions": {extension + "/main": enable}})
def install(use_symlink=False, profile='default', enable=True): # Install the livereveal code. install_nbextension(livereveal_dir, symlink=use_symlink, overwrite=use_symlink, user=True) if enable: # Enable the extension in the given profile. profile_dir = locate_profile(profile) cm = ConfigManager(profile_dir=profile_dir) cm.update('notebook', {"load_extensions": {"livereveal/main": True}})
def __init__(self, *args, **kwargs): # Install the nbextension when instantiated from os.path import dirname, abspath, join as pjoin from IPython.html.nbextensions import install_nbextension from IPython.html.services.config import ConfigManager # Install the extension notebookdiffdir = pjoin(dirname(abspath(__file__)), 'notebookdiff_js') install_nbextension(notebookdiffdir, user=True) # Enable the extension cm = ConfigManager() cm.update('notebook', {"load_extensions": {"notebookdiff_js/notebook_ui": True}}) # call the parent constructor super(NotebookDiffContentsManager, self).__init__(*args, **kwargs)
def _install_js(): install_nbextension(EXT_DIR, destination='nbexamples', overwrite=True, user=True, verbose=2) cm = ConfigManager() print('Enabling extension for notebook') cm.update("notebook", {"load_extensions": {"nbexamples/submit-example-button": True}}) cm.update("tree", {"load_extensions": {"nbexamples/main": True}})
def run(self): print('Installing Python module') install.run(self) print('Installing notebook extension') install_nbextension(EXT_DIR, overwrite=True, user=True) cm = ConfigManager() print('Enabling extension for notebook') cm.update('notebook', {"load_extensions": {'urth_dash_js/notebook/main': True}}) print('Installing notebook server extension') fn = os.path.join(cm.profile_dir, 'ipython_notebook_config.py') if os.path.isfile(fn): with open(fn, 'r+') as fh: lines = fh.read() if SERVER_EXT_CONFIG not in lines: fh.seek(0, 2) fh.write('\n') fh.write(SERVER_EXT_CONFIG) else: with open(fn, 'w') as fh: fh.write('c = get_config()\n') fh.write(SERVER_EXT_CONFIG)
def run(self): print("Installing Python module") install.run(self) print("Installing notebook extension") install_nbextension(EXT_DIR, overwrite=True, user=True) cm = ConfigManager() print("Enabling extension for notebook") cm.update("notebook", {"load_extensions": {"urth_dash_js/notebook/main": True}}) print("Installing notebook server extension") fn = os.path.join(cm.profile_dir, "ipython_notebook_config.py") if os.path.isfile(fn): with open(fn, "r+") as fh: lines = fh.read() if SERVER_EXT_CONFIG not in lines: fh.seek(0, 2) fh.write("\n") fh.write(SERVER_EXT_CONFIG) else: with open(fn, "w") as fh: fh.write("c = get_config()\n") fh.write(SERVER_EXT_CONFIG)
def run_nbextension_install(develop): install_nbextension(extension_dir, symlink=develop, user=user) if enable is not None: print("Enabling the extension ...") cm = ConfigManager() cm.update('notebook', {"load_extensions": {enable: True}})
from IPython.html.services.config import ConfigManager from IPython.utils.path import locate_profile cm = ConfigManager(profile_dir=locate_profile(get_ipython().profile)) cm.update('livereveal', { 'theme': 'beige', 'transition': 'fade', 'start_slideshow_at': 'selected', })
from os.path import dirname, abspath, join as pjoin from IPython.html.nbextensions import install_nbextension from IPython.html.services.config import ConfigManager print("Installing nbextension ...") notebookdiffdir = pjoin(dirname(abspath(__file__)), 'notebookdiff_js') install_nbextension(notebookdiffdir, user=True) print("Enabling the extension ...") cm = ConfigManager() cm.update('notebook', {"load_extensions": {"notebookdiff_js/notebook_ui": True}}) print("Done.")
#!/usr/bin/env python from os import path from IPython.html.nbextensions import install_nbextension from IPython.html.services.config import ConfigManager install_nbextension( path.join(path.dirname(path.abspath(__file__)), 'notebook_input_mode'), user=True, verbose=2) cm = ConfigManager().update('notebook', {"load_extensions": {"notebook_input_mode/main": True}})
#!/usr/bin/env python from os.path import dirname, abspath, join as pjoin from IPython.html.nbextensions import install_nbextension from IPython.html.services.config import ConfigManager print("Installing nbextension ...") c2cdir = pjoin(dirname(abspath(__file__)), 'cite2c') install_nbextension(c2cdir, user=True) print("Enabling the extension ...") cm = ConfigManager() cm.update('notebook', {"load_extensions": {"cite2c/main": True}}) print("Done.")
# coding: utf-8 # In[4]: from IPython.html.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) # In[5]: extensions
# coding: utf-8 # In[1]: from IPython.display import Image # In[5]: from IPython.html.services.config import ConfigManager from IPython.utils.path import locate_profile cm = ConfigManager(profile_dir=locate_profile(get_ipython().profile)) cm.update('livereveal', { 'theme': 'simple', 'start_slideshow_at': 'selected', }) # In[6]: get_ipython().magic(u'matplotlib inline') import matplotlib.pyplot as plt import seaborn as sns sns.set() import numpy as np import pandas as pd # # IPython Notebook best practices for data science #