diff --git a/nbtools.json b/nbtools.json new file mode 100644 index 0000000..39234ec --- /dev/null +++ b/nbtools.json @@ -0,0 +1,5 @@ +{ + "load_extensions": { + "nbtools/nbtools": true + } +} \ No newline at end of file diff --git a/nbtools/__init__.py b/nbtools/__init__.py index e894b5e..bc428f5 100644 --- a/nbtools/__init__.py +++ b/nbtools/__init__.py @@ -7,8 +7,8 @@ import IPython __author__ = 'Thorin Tabor' -__copyright__ = 'Copyright 2016-2017, Regents of the University of California & Broad Institute' -__version__ = '0.1.6' +__copyright__ = 'Copyright 2016-2018, Regents of the University of California & Broad Institute' +__version__ = '0.1.7' __status__ = 'Beta' __license__ = 'BSD' diff --git a/setup.py b/setup.py index fe14df2..cbc0a6c 100644 --- a/setup.py +++ b/setup.py @@ -1,51 +1,30 @@ +import os from distutils.core import setup -from setuptools.command.install import install as _install -from setuptools.command.develop import develop as _develop -def _post_install(): - import subprocess - from distutils import log - log.set_verbosity(log.DEBUG) - - try: - # Enable the required nbextension for ipywidgets - subprocess.call(["jupyter", "nbextension", "enable", "--py", "widgetsnbextension"]) - - # Enable the GenePattern Notebook extension - subprocess.call(["jupyter", "nbextension", "install", "--py", "nbtools"]) - subprocess.call(["jupyter", "nbextension", "enable", "--py", "nbtools"]) - subprocess.call(["jupyter", "serverextension", "enable", "--py", "nbtools"]) - except: - log.warn("Unable to automatically enable Notebook Tool Manager extension for Jupyter.\n" + - "Please manually enable the extension by running the following commands:\n" + - "jupyter nbextension enable --py widgetsnbextension\n" + - "jupyter nbextension install --py nbtools\n" + - "jupyter nbextension enable --py nbtools\n" + - "jupyter serverextension enable --py nbtools\n") - - -class NBInstall(_install): - def run(self): - _install.run(self) - self.execute(_post_install, [], msg="Running post install task") - - -class NBDevelop(_develop): - def run(self): - _develop.run(self) - self.execute(_post_install, [], msg="Running post develop task") +def get_data_files(): + """ + Get the data files for the package. + """ + return [ + ('share/jupyter/nbextensions/nbtools', [ + 'nbtools/static/nbtools.js', + 'nbtools/static/toolbox.css', + 'nbtools/static/toolbox.js', + ]), + ('etc/jupyter/nbconfig/notebook.d', ['nbtools.json']), + ] setup(name='nbtools', packages=['nbtools'], - version='0.1.6', + version='0.1.7', description='A lightweight manager for registering and browsing Jupyter tools', license='BSD', author='Thorin Tabor', author_email='thorin@broadinstitute.org', url='https://github.com/genepattern/nbtool-manager', - download_url='https://github.com/genepattern/nbtool-manager/archive/0.1.6.tar.gz', + download_url='https://github.com/genepattern/nbtool-manager/archive/0.1.7.tar.gz', keywords=['genepattern', 'genomics', 'bioinformatics', 'ipython', 'jupyter'], classifiers=[ 'Development Status :: 4 - Beta', @@ -61,7 +40,8 @@ def run(self): 'notebook>=4.2.0', 'ipywidgets>=5.0.0', ], - cmdclass={'install': NBInstall, 'develop': NBDevelop}, package_data={'nbtools': ['static/nbtools.js', 'static/toolbox.js', 'static/toolbox.css', 'jsobject/backend_context.js', 'jsobject/jsobject.py', 'jsobject/utils.py', 'jsobject/__init__.py']}, + data_files=get_data_files(), ) +