forked from tensorflow/probability
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
119 lines (106 loc) · 4.03 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Install tensorflow_probability."""
import datetime
import os
import sys
from setuptools import find_packages
from setuptools import setup
from setuptools.command.install import install as InstallCommandBase
from setuptools.dist import Distribution
# To enable importing version.py directly, we add its path to sys.path.
version_path = os.path.join(
os.path.dirname(__file__), 'tensorflow_probability', 'python')
sys.path.append(version_path)
from version import __version__ # pylint: disable=g-import-not-at-top
REQUIRED_PACKAGES = [
'six >= 1.10.0',
# Currently numpy>=1.15.0 causes test failures in TensorFlow so they've
# constrained to these slightly older versions. Fix is planned for 1.11
# release.
# TODO(b/112417381): revert this once TF issues are fixed.
'numpy <=1.14.5, >=1.13.3',
]
REQUIRED_TENSORFLOW_VERSION = '1.10.0'
if '--gpu' in sys.argv:
use_gpu = True
sys.argv.remove('--gpu')
else:
use_gpu = False
if '--release' in sys.argv:
release = True
sys.argv.remove('--release')
else:
# Build a nightly package by default.
release = False
maybe_gpu_suffix = '-gpu' if use_gpu else ''
if release:
project_name = 'tensorflow-probability' + maybe_gpu_suffix
tensorflow_package_name = 'tensorflow{}>={}'.format(
maybe_gpu_suffix, REQUIRED_TENSORFLOW_VERSION)
else:
# Nightly releases use date-based versioning of the form
# '0.0.1.dev20180305'
project_name = 'tfp-nightly' + maybe_gpu_suffix
datestring = datetime.datetime.now().strftime('%Y%m%d')
__version__ += datestring
tensorflow_package_name = 'tf-nightly{}'.format(
maybe_gpu_suffix)
REQUIRED_PACKAGES.append(tensorflow_package_name)
class BinaryDistribution(Distribution):
"""This class is needed in order to create OS specific wheels."""
def has_ext_modules(self):
return False
setup(
name=project_name,
version=__version__,
description='Probabilistic modeling and statistical '
'inference in TensorFlow',
author='Google LLC',
author_email='[email protected]',
url='http://github.com/tensorflow/probability',
license='Apache 2.0',
packages=find_packages(),
install_requires=REQUIRED_PACKAGES,
# Add in any packaged data.
include_package_data=True,
package_data={'': ['*.so']},
exclude_package_data={'': ['BUILD', '*.h', '*.cc']},
zip_safe=False,
distclass=BinaryDistribution,
cmdclass={
'pip_pkg': InstallCommandBase,
},
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords='tensorflow probability statistics bayesian machine learning',
)