1# Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License.. 14# ============================================================================== 15"""TensorFlow is an open source machine learning framework for everyone. 16 17[](https://badge.fury.io/py/tensorflow) 18[](https://badge.fury.io/py/tensorflow) 19 20TensorFlow is an open source software library for high performance numerical 21computation. Its flexible architecture allows easy deployment of computation 22across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters 23of servers to mobile and edge devices. 24 25Originally developed by researchers and engineers from the Google Brain team 26within Google's AI organization, it comes with strong support for machine 27learning and deep learning and the flexible numerical computation core is used 28across many other scientific domains. 29""" 30# We use this to build installer wheels whose only job would be to install the 31# third-party TensorFlow packages from Google's official partners. 32# Note: This is experimental for now and is used internally for testing. 33import sys 34 35from setuptools import setup 36 37 38# This version string is semver compatible, but incompatible with pip. 39# For pip, we will remove all '-' characters from this string, and use the 40# result for pip. 41# Also update tensorflow/tensorflow.bzl and 42# tensorflow/core/public/version.h 43_VERSION = '2.11.0' 44 45 46# We use the same setup.py for all tensorflow_* packages and for the nightly 47# equivalents (tf_nightly_*). The package is controlled from the argument line 48# when building the pip package. 49project_name = 'tensorflow' 50if '--project_name' in sys.argv: 51 project_name_idx = sys.argv.index('--project_name') 52 project_name = sys.argv[project_name_idx + 1] 53 sys.argv.remove('--project_name') 54 sys.argv.pop(project_name_idx) 55 56 57# Returns standard if a tensorflow-* package is being built, and nightly if a 58# tf_nightly-* package is being built. 59def standard_or_nightly(standard, nightly): 60 return nightly if 'tf_nightly' in project_name else standard 61 62# Install the trusted partner packages with the same version as the installer 63# wheel 64REQUIRED_PACKAGES = [ 65 # Install the TensorFlow package built by AWS if the user is running 66 # Linux on an Aarch64 machine. 67 standard_or_nightly('tensorflow-cpu-aws', 'tf-nightly-cpu-aws ') + '==' + 68 _VERSION + 69 ';platform_system=="Linux" and (platform_machine=="arm64" or ' 70 'platform_machine=="aarch64")', 71 # Install the TensorFlow package built by Intel if the user is on a Windows 72 # machine. 73 standard_or_nightly('tensorflow-intel', 'tf-nightly-intel') + 74 '==' + _VERSION + ';platform_system=="Windows"', 75] 76REQUIRED_PACKAGES = [p for p in REQUIRED_PACKAGES if p is not None] 77 78DOCLINES = __doc__.split('\n') 79if project_name.endswith('-gpu'): 80 project_name_no_gpu = project_name[:-len('-gpu')] 81 _GPU_PACKAGE_NOTE = 'Note that %s package by default supports both CPU and '\ 82 'GPU. %s has the same content and exists solely for backward '\ 83 'compatibility. Please migrate to %s for GPU support.'\ 84 % (project_name_no_gpu, project_name, project_name_no_gpu) 85 DOCLINES.append(_GPU_PACKAGE_NOTE) 86 87setup( 88 name=project_name, 89 version=_VERSION.replace('-', ''), 90 description=DOCLINES[0], 91 long_description='\n'.join(DOCLINES[2:]), 92 long_description_content_type='text/markdown', 93 url='https://www.tensorflow.org/', 94 download_url='https://github.com/tensorflow/tensorflow/tags', 95 author='Google Inc.', 96 author_email='[email protected]', 97 install_requires=REQUIRED_PACKAGES, 98 zip_safe=False, 99 # Supported Python versions 100 python_requires='>=3.7', 101 # PyPI package information. 102 classifiers=sorted([ 103 'Development Status :: 5 - Production/Stable', 104 # TODO(angerson) Add IFTTT when possible 105 'Environment :: GPU :: NVIDIA CUDA :: 11.2', 106 'Intended Audience :: Developers', 107 'Intended Audience :: Education', 108 'Intended Audience :: Science/Research', 109 'License :: OSI Approved :: Apache Software License', 110 'Programming Language :: Python :: 3', 111 'Programming Language :: Python :: 3.7', 112 'Programming Language :: Python :: 3.8', 113 'Programming Language :: Python :: 3.9', 114 'Programming Language :: Python :: 3.10', 115 'Programming Language :: Python :: 3 :: Only', 116 'Topic :: Scientific/Engineering', 117 'Topic :: Scientific/Engineering :: Mathematics', 118 'Topic :: Scientific/Engineering :: Artificial Intelligence', 119 'Topic :: Software Development', 120 'Topic :: Software Development :: Libraries', 121 'Topic :: Software Development :: Libraries :: Python Modules', 122 ]), 123 license='Apache 2.0', 124 keywords='tensorflow tensor machine learning', 125) 126 127