setup.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # -*- coding: utf-8 -*-
  2. # Copyright (c) Jupyter Development Team.
  3. # Distributed under the terms of the Modified BSD License.
  4. from __future__ import print_function
  5. from distutils import log
  6. import json
  7. import os
  8. import sys
  9. # Our own imports
  10. from setupbase import (
  11. find_packages,
  12. js_prerelease,
  13. NPM
  14. )
  15. # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
  16. # update it when the contents of directories change.
  17. if os.path.exists('MANIFEST'): os.remove('MANIFEST')
  18. from distutils.core import setup
  19. here = os.path.dirname(os.path.abspath(__file__))
  20. log.set_verbosity(log.DEBUG)
  21. log.info('setup.py entered')
  22. DESCRIPTION = 'An alpha preview of the JupyterLab notebook server extension.'
  23. 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.'
  24. # Get the npm package version and set the python package to the same.
  25. with open(os.path.join(here, 'package.json')) as f:
  26. packagejson = json.load(f)
  27. with open(os.path.join(here, 'jupyterlab', '_version.py'), 'w') as f:
  28. f.write('# This file is auto-generated, do not edit!\n')
  29. f.write('__version__ = "%s"\n' % packagejson['version'])
  30. #---------------------------------------------------------------------------
  31. # custom distutils commands
  32. #---------------------------------------------------------------------------
  33. # imports here, so they are after setuptools import if there was one
  34. from distutils.command.build_py import build_py
  35. from distutils.command.sdist import sdist
  36. setup_args = {
  37. 'name': 'jupyterlab',
  38. 'version': packagejson['version'],
  39. 'description': DESCRIPTION,
  40. 'long_description': LONG_DESCRIPTION,
  41. 'License': 'BSD',
  42. 'include_package_data': True,
  43. 'install_requires': ['notebook>=4.2.0'],
  44. 'packages': find_packages(),
  45. 'pack'
  46. 'zip_safe': False,
  47. 'package_data': {'jupyterlab': [
  48. 'build/*',
  49. 'lab.html'
  50. ]},
  51. 'cmdclass': {
  52. 'build_py': js_prerelease(build_py),
  53. 'sdist': js_prerelease(sdist, strict=True),
  54. 'jsdeps': NPM,
  55. },
  56. 'entry_points': {
  57. 'console_scripts': [
  58. 'jupyter-lab = jupyterlab.labapp:main',
  59. 'jupyter-labextension = jupyterlab.labextensions:main',
  60. ]
  61. },
  62. 'author': 'Jupyter Development Team',
  63. 'author_email': 'jupyter@googlegroups.com',
  64. 'url': 'https://github.com/jupyter/jupyterlab',
  65. 'keywords': ['ipython', 'jupyter', 'Web'],
  66. 'classifiers': [
  67. 'Development Status :: 2 - Pre-Alpha',
  68. 'Intended Audience :: Developers',
  69. 'Intended Audience :: Science/Research',
  70. 'License :: OSI Approved :: BSD License',
  71. 'Programming Language :: Python :: 2',
  72. 'Programming Language :: Python :: 2.7',
  73. 'Programming Language :: Python :: 3',
  74. ],
  75. }
  76. #---------------------------------------------------------------------------
  77. # Handle scripts, dependencies, and setuptools specific things
  78. #---------------------------------------------------------------------------
  79. if any(arg.startswith('bdist') for arg in sys.argv):
  80. import setuptools
  81. # This dict is used for passing extra arguments that are setuptools
  82. # specific to setup
  83. setuptools_extra_args = {}
  84. if 'setuptools' in sys.modules:
  85. # setup.py develop should check for submodules
  86. from setuptools.command.develop import develop
  87. setup_args['cmdclass']['develop'] = js_prerelease(develop)
  88. try:
  89. from wheel.bdist_wheel import bdist_wheel
  90. except ImportError:
  91. pass
  92. else:
  93. setup_args['cmdclass']['bdist_wheel'] = js_prerelease(bdist_wheel)
  94. setuptools_extra_args['zip_safe'] = False
  95. #---------------------------------------------------------------------------
  96. # Do the actual setup now
  97. #---------------------------------------------------------------------------
  98. setup_args.update(setuptools_extra_args)
  99. def main():
  100. setup(**setup_args)
  101. if __name__ == '__main__':
  102. main()