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.9 kB

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

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