setup.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. # Copyright (c) Jupyter Development Team.
  4. # Distributed under the terms of the Modified BSD License.
  5. from __future__ import print_function
  6. # the name of the project
  7. name = 'jupyterlab'
  8. #-----------------------------------------------------------------------------
  9. # Minimal Python version sanity check
  10. #-----------------------------------------------------------------------------
  11. import sys
  12. v = sys.version_info
  13. if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
  14. error = "ERROR: %s requires Python version 2.7 or 3.3 or above." % name
  15. print(error, file=sys.stderr)
  16. sys.exit(1)
  17. PY3 = (sys.version_info[0] >= 3)
  18. #-----------------------------------------------------------------------------
  19. # get on with it
  20. #-----------------------------------------------------------------------------
  21. from distutils import log
  22. import json
  23. import os
  24. from glob import glob
  25. from distutils.command.build_ext import build_ext
  26. from distutils.command.sdist import sdist
  27. from setuptools import setup
  28. from setuptools.command.bdist_egg import bdist_egg
  29. # Our own imports
  30. from setupbase import (
  31. bdist_egg_disabled,
  32. find_packages,
  33. find_package_data,
  34. js_prerelease,
  35. NPM
  36. )
  37. # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
  38. # update it when the contents of directories change.
  39. if os.path.exists('MANIFEST'): os.remove('MANIFEST')
  40. here = os.path.dirname(os.path.abspath(__file__))
  41. pjoin = os.path.join
  42. DESCRIPTION = 'An alpha preview of the JupyterLab notebook server extension.'
  43. LONG_DESCRIPTION = 'This is an alpha preview of JupyterLab. It is not ready for general usage yet. Development happens on https://github.com/jupyter/jupyterlab, with chat on https://gitter.im/jupyter/jupyterlab.'
  44. # Get the npm package version and set the python package to the same.
  45. with open(os.path.join(here, 'package.json')) as f:
  46. packagejson = json.load(f)
  47. with open(os.path.join(here, 'jupyterlab', '_version.py'), 'w') as f:
  48. f.write('# This file is auto-generated, do not edit!\n')
  49. f.write('__version__ = "%s"\n' % packagejson['version'])
  50. setup_args = dict(
  51. name = name,
  52. description = DESCRIPTION,
  53. long_description = LONG_DESCRIPTION,
  54. version = packagejson['version'],
  55. scripts = glob(pjoin('scripts', '*')),
  56. packages = find_packages(),
  57. package_data = find_package_data(),
  58. author = 'Jupyter Development Team',
  59. author_email = 'jupyter@googlegroups.com',
  60. url = 'http://jupyter.org',
  61. license = 'BSD',
  62. platforms = "Linux, Mac OS X, Windows",
  63. keywords = ['ipython', 'jupyter', 'Web'],
  64. classifiers = [
  65. 'Development Status :: 3 - Alpha',
  66. 'Intended Audience :: Developers',
  67. 'Intended Audience :: System Administrators',
  68. 'Intended Audience :: Science/Research',
  69. 'License :: OSI Approved :: BSD License',
  70. 'Programming Language :: Python',
  71. 'Programming Language :: Python :: 2.7',
  72. 'Programming Language :: Python :: 3',
  73. 'Programming Language :: Python :: 3.3',
  74. 'Programming Language :: Python :: 3.4',
  75. 'Programming Language :: Python :: 3.5',
  76. ],
  77. )
  78. cmdclass = dict(
  79. build_ext = js_prerelease(build_ext),
  80. sdist = js_prerelease(sdist, strict=True),
  81. jsdeps = NPM,
  82. bdist_egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
  83. )
  84. try:
  85. from wheel.bdist_wheel import bdist_wheel
  86. cmdclass['bdist_wheel'] = js_prerelease(bdist_wheel, strict=True)
  87. except ImportError:
  88. pass
  89. setup_args['cmdclass'] = cmdclass
  90. setuptools_args = {}
  91. install_requires = setuptools_args['install_requires'] = [
  92. 'notebook>=4.2.0',
  93. ]
  94. extras_require = setuptools_args['extras_require'] = {
  95. 'test:python_version == "2.7"': ['mock'],
  96. 'test': ['pytest'],
  97. 'docs': [
  98. 'sphinx',
  99. 'recommonmark',
  100. 'sphinx_rtd_theme'
  101. ],
  102. }
  103. if 'setuptools' in sys.modules:
  104. setup_args.update(setuptools_args)
  105. # force entrypoints with setuptools (needed for Windows, unconditional because of wheels)
  106. setup_args['entry_points'] = {
  107. 'console_scripts': [
  108. 'jupyter-lab = jupyterlab.labapp:main',
  109. 'jupyter-labextension = jupyterlab.labextensions:main',
  110. ]
  111. }
  112. setup_args.pop('scripts', None)
  113. setup_args.update(setuptools_args)
  114. if __name__ == '__main__':
  115. setup(**setup_args)