-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
With this it would be trivial to include this plugin in a conda environment.
What needs to be done during package installation:
- install server extension
- enable server extension
- install frontend extension
- enable frontend extension
Currently we do this by hand and via bash. It needs to be done python and automatically.
according to this blog post it is possible.
Their example the setup.py is this:
import os
from setuptools import setup
from setuptools.command.install import install
from notebook.nbextensions import install_nbextension
from notebook.services.config import ConfigManager
from jupyter_core.paths import jupyter_config_dir
EXT_DIR = os.path.join(os.path.dirname(__file__), 'myext')
class InstallCommand(install):
def run(self):
# Install Python package
install.run(self)
# Install JavaScript extensions to ~/.local/jupyter/
install_nbextension(EXT_DIR, overwrite=True, user=True)
# Activate the JS extensions on the notebook, tree, and edit screens
js_cm = ConfigManager()
js_cm.update('notebook', {"load_extensions": {'myext_js/notebook': True}})
js_cm.update('tree', {"load_extensions": {'myext_js/dashboard': True}})
js_cm.update('edit', {"load_extensions": {'myext_js/editor': True}})
# Activate the Python server extension
server_cm = ConfigManager(config_dir=jupyter_config_dir())
cfg = server_cm.get('jupyter_notebook_config')
server_extensions = (cfg.setdefault('NotebookApp', {})
.setdefault('server_extensions', [])
)
if extension not in server_extensions:
cfg['NotebookApp']['server_extensions'] += ['myext.my_handler']
server_cm.update('jupyter_notebook_config', cfg)
setup(
name='myext',
version='0.1',
packages=['myext'],
cmdclass={
'install': InstallCommand
}
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels