You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

setup.py 5.8 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #!/usr/bin/env python
  2. import codecs
  3. import os
  4. import sys
  5. os.environ['TENSORLAYER_PACKAGE_BUILDING'] = 'True'
  6. try:
  7. from setuptools import find_packages, setup, Extension
  8. from setuptools.command.build_ext import build_ext
  9. except ImportError:
  10. from distutils.core import (setup, find_packages)
  11. from tensorlayer import (
  12. __contact_emails__, __contact_names__, __description__, __download_url__, __homepage__, __keywords__, __license__,
  13. __package_name__, __repository_url__, __version__
  14. )
  15. # =================== Reading Readme file as TXT files ===================
  16. if os.path.exists('README.rst'):
  17. # codec is used for consistent encoding
  18. long_description = codecs.open(
  19. os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.rst'), 'r', 'utf-8'
  20. ).read()
  21. else:
  22. long_description = 'See ' + __homepage__
  23. # ======================= Reading Requirements files as TXT files =======================
  24. def req_file(filename, folder="requirements"):
  25. with open(os.path.join(folder, filename)) as f:
  26. content = f.readlines()
  27. # you may also want to remove whitespace characters
  28. # Example: `\n` at the end of each line
  29. return [x.strip() for x in content]
  30. # ======================= Defining the requirements var =======================
  31. install_requires = req_file("requirements.txt")
  32. extras_require = {
  33. # User packages
  34. 'tf_cpu': req_file("requirements_tf_cpu.txt"),
  35. 'tf_gpu': req_file("requirements_tf_gpu.txt"),
  36. 'extra': req_file("requirements_extra.txt"),
  37. # Contrib Packages
  38. 'contrib_loggers': req_file("requirements_contrib_loggers.txt"),
  39. # Dev Packages
  40. 'test': req_file("requirements_test.txt"),
  41. 'dev': req_file("requirements_dev.txt"),
  42. 'doc': req_file("requirements_doc.txt"),
  43. 'db': req_file("requirements_db.txt"),
  44. }
  45. extras_require['all'] = sum([extras_require.get(key) for key in ['extra', 'contrib_loggers']], list())
  46. extras_require['all_cpu'] = sum([extras_require.get(key) for key in ['all', 'tf_cpu']], list())
  47. extras_require['all_gpu'] = sum([extras_require.get(key) for key in ['all', 'tf_gpu']], list())
  48. extras_require['all_dev'] = sum([extras_require.get(key) for key in ['all', 'db', 'dev', 'doc', 'test']], list())
  49. extras_require['all_cpu_dev'] = sum([extras_require.get(key) for key in ['all_dev', 'tf_cpu']], list())
  50. extras_require['all_gpu_dev'] = sum([extras_require.get(key) for key in ['all_dev', 'tf_gpu']], list())
  51. cmdclass = dict()
  52. ext_modules = []
  53. # Readthedocs requires TF 1.5.0 to build properly
  54. if 'READTHEDOCS' in os.environ:
  55. ext_modules = [
  56. Extension('install_requirements_for_rtd', []),
  57. ]
  58. class custom_build_ext(build_ext):
  59. def build_extensions(self):
  60. os.system('./scripts/install-requirements-for-rtd.sh %s' % os.path.dirname(sys.executable))
  61. cmdclass = {'build_ext': custom_build_ext}
  62. # ======================= Define the package setup =======================
  63. setup(
  64. name=__package_name__,
  65. # Versions should comply with PEP440. For a discussion on single-sourcing
  66. # the version across setup.py and the project code, see
  67. # https://packaging.python.org/en/latest/single_source_version.html
  68. version=__version__,
  69. description=__description__,
  70. long_description=long_description,
  71. # The project's main homepage.
  72. url=__repository_url__,
  73. download_url=__download_url__,
  74. # Author details
  75. author=__contact_names__,
  76. author_email=__contact_emails__,
  77. # maintainer Details
  78. maintainer=__contact_names__,
  79. maintainer_email=__contact_emails__,
  80. # The licence under which the project is released
  81. license=__license__,
  82. classifiers=[
  83. # How mature is this project? Common values are
  84. # 1 - Planning
  85. # 2 - Pre-Alpha
  86. # 3 - Alpha
  87. # 4 - Beta
  88. # 5 - Production/Stable
  89. # 6 - Mature
  90. # 7 - Inactive
  91. 'Development Status :: 5 - Production/Stable',
  92. # Indicate who your project is intended for
  93. 'Intended Audience :: Developers',
  94. 'Intended Audience :: Science/Research',
  95. 'Intended Audience :: Information Technology',
  96. # Indicate what your project relates to
  97. 'Topic :: Scientific/Engineering',
  98. 'Topic :: Scientific/Engineering :: Image Recognition',
  99. 'Topic :: Scientific/Engineering :: Artificial Intelligence',
  100. 'Topic :: Software Development :: Libraries',
  101. 'Topic :: Utilities',
  102. # Pick your license as you wish (should match "license" above)
  103. 'License :: OSI Approved :: Apache Software License',
  104. # Specify the Python versions you support here. In particular, ensure
  105. # that you indicate whether you support Python 2, Python 3 or both.
  106. 'Programming Language :: Python :: 2',
  107. 'Programming Language :: Python :: 2.7',
  108. 'Programming Language :: Python :: 3',
  109. 'Programming Language :: Python :: 3.5',
  110. 'Programming Language :: Python :: 3.6',
  111. # Additionnal Settings
  112. 'Environment :: Console',
  113. 'Natural Language :: English',
  114. 'Operating System :: OS Independent',
  115. ],
  116. keywords=__keywords__,
  117. packages=find_packages(),
  118. # List run-time dependencies here. These will be installed by pip when
  119. # your project is installed. For an analysis of "install_requires" vs pip's
  120. # requirements files see:
  121. # https://packaging.python.org/en/latest/requirements.html
  122. install_requires=install_requires,
  123. cmdclass=cmdclass,
  124. # List additional groups of dependencies here (e.g. development
  125. # dependencies). You can install these using the following syntax,
  126. # $ pip install -e .[test]
  127. extras_require=extras_require,
  128. ext_modules=ext_modules,
  129. scripts=[
  130. 'tl',
  131. ],
  132. )

TensorLayer3.0 是一款兼容多种深度学习框架为计算后端的深度学习库。计划兼容TensorFlow, Pytorch, MindSpore, Paddle.