#!/usr/bin/env python
# -*- coding: utf-8 -*-

# -*- coding: utf-8 -*-

try:
    from setuptools import setup
    from setuptools.command.install import install
except ImportError:
    from distutils.core import setup
    from distutils.core.command.install import install

from IPython.html.nbextensions import install_nbextension

def make_cmdclass(setupfile, path, enable=None):
    """Build nbextension cmdclass dict for the setuptools.setup method.

    Parameters
    ----------
    setupfile: str
        Path to the setup file.
    path: str
        Directory relative to the setup file that the nbextension code lives in.
    enable: [str=None]
        Extension to "enable".  Enabling an extension causes it to be loaded
        automatically by the IPython notebook.

    Usage
    -----
    setup(
        name='flightwidgets',
        ...
        cmdclass=make_cmdclass(__file__, 'flightwidgets', 'flightwidgets/init'),
    )
    """

    from setuptools.command.install import install
    from setuptools.command.develop import develop
    from os.path import dirname, abspath, join

    from IPython.html.services.config import ConfigManager

    def run_nbextension_install(develop):
        install_nbextension(join(dirname(abspath(setupfile)), path), symlink=develop)
        if enable is not None:
            print("Enabling the extension ...")
            cm = ConfigManager()
            cm.update('notebook', {"load_extensions": {enable: True}})

    class InstallCommand(install):
        def run(self):
            print("Installing Python module...")
            install.run(self)
            print("Installing nbextension ...")
            run_nbextension_install(False)

    class DevelopCommand(develop):
        def run(self):
            print("Installing Python module...")
            develop.run(self)
            print("Installing nbextension ...")
            run_nbextension_install(True)
    
    return {
        'install': InstallCommand,
        'develop': DevelopCommand,
    }


from glob import glob 
setup(
    name='bitjet',
    version='0.1',
    description='Binary visualization using IPython widgets',
    author='Kyle Kelley',
    author_email='rgbkrk@gmail.com',
    license='New BSD License',
    url='https://github.com/rgbkrk/bitjet',
    keywords='data visualization interactive interaction python ipython widgets widget',
    install_requires=['ipython'],
    classifiers=['Development Status :: 4 - Beta',
                 'Programming Language :: Python',
                 'License :: OSI Approved :: MIT License'],
    packages=['bitjet'],
    include_package_data=True,
    cmdclass=make_cmdclass(__file__, 'bitjet')
)

@@ -43,2006 +43,121 @@
 -*-%0A
-%0A# -*- coding: utf-8 -*-%0A%0Atry:%0A    from setuptools import setup%0A    from setuptools.command.install import install%0Aexcept ImportError:%0A    from distutils.core import setup%0A    from distutils.core.command.install import install%0A%0Afrom IPython.html.nbextensions import install_nbextension%0A%0Adef make_cmdclass(setupfile, path, enable=None):%0A    %22%22%22Build nbextension cmdclass dict for the setuptools.setup method.%0A%0A    Parameters%0A    ----------%0A    setupfile: str%0A        Path to the setup file.%0A    path: str%0A        Directory relative to the setup file that the nbextension code lives in.%0A    enable: %5Bstr=None%5D%0A        Extension to %22enable%22.  Enabling an extension causes it to be loaded%0A        automatically by the IPython notebook.%0A%0A    Usage%0A    -----%0A    setup(%0A        name='flightwidgets',%0A        ...%0A        cmdclass=make_cmdclass(__file__, 'flightwidgets', 'flightwidgets/init'),%0A    )%0A    %22%22%22%0A%0A    from setuptools.command.install import install%0A    from setuptools.command.develop import develop%0A    from os.path import dirname, abspath, join%0A%0A    from IPython.html.services.config import ConfigManager%0A%0A    def run_nbextension_install(develop):%0A        install_nbextension(join(dirname(abspath(setupfile)), path), symlink=develop)%0A        if enable is not None:%0A            print(%22Enabling the extension ...%22)%0A            cm = ConfigManager()%0A            cm.update('notebook', %7B%22load_extensions%22: %7Benable: True%7D%7D)%0A%0A    class InstallCommand(install):%0A        def run(self):%0A            print(%22Installing Python module...%22)%0A            install.run(self)%0A            print(%22Installing nbextension ...%22)%0A            run_nbextension_install(False)%0A%0A    class DevelopCommand(develop):%0A        def run(self):%0A            print(%22Installing Python module...%22)%0A            develop.run(self)%0A            print(%22Installing nbextension ...%22)%0A            run_nbextension_install(True)%0A    %0A    return %7B%0A        'install': InstallCommand,%0A        'develop': DevelopCommand,%0A    %7D%0A%0A%0Afrom glob import glob 
+from setuptools import setup%0A%0Atry:%0A    from ipythonpip import cmdclass%0Aexcept:%0A    cmdclass = lambda *args: None%0A
 %0Aset
@@ -518,16 +518,31 @@
 ipython'
+, 'ipython-pip'
 %5D,%0A    c
@@ -771,13 +771,8 @@
 ass=
-make_
 cmdc
@@ -780,18 +780,8 @@
 ass(
-__file__, 
 'bit
@@ -785,11 +785,12 @@
 bitjet')
+,
 %0A)%0A

Use ipython-pip