from setuptools import setup

import versioneer


setup(name='runipy',
      version=versioneer.get_version(),
      description='Run IPython notebooks from the command line',
      url='https://github.com/paulgb/runipy',
      author='Paul Butler',
      author_email='paulgb@gmail.com',
      classifiers=[
          'Framework :: IPython',
      ],
      install_requires=[
          'Jinja2>=2.7.2',
          'Pygments>=1.6',
          'ipython>=2.3.1',
          'pyzmq>=14.1.0',
      ],
      packages=['runipy'],
      entry_points={
          'console_scripts': [
              'runipy = runipy.main:main'
          ]
      },
      cmdclass=versioneer.get_cmdclass(),
      test_suite="test_runipy"
)

from setuptools import setup

import versioneer


using_ipy4 = False
try:
    from IPython import __version__ as ipyv
    from distutils.version import LooseVersion

    using_ipy4 = (ipyv >= LooseVersion("4"))
except ImportError:
    using_ipy4 = True

setup(name='runipy',
      version=versioneer.get_version(),
      description='Run IPython notebooks from the command line',
      url='https://github.com/paulgb/runipy',
      author='Paul Butler',
      author_email='paulgb@gmail.com',
      classifiers=[
          'Framework :: IPython',
      ],
      install_requires=[
          'Jinja2>=2.7.2',
          'Pygments>=1.6',
          'ipython>=2.3.1',
          'pyzmq>=14.1.0',
      ],
      packages=['runipy'],
      entry_points={
          'console_scripts': [
              'runipy = runipy.main:main'
          ]
      },
      cmdclass=versioneer.get_cmdclass(),
      test_suite="test_runipy"
)

Check what version of iPython is in use. If one is not present assume, iPython 4 will be installed and treat it as such.