forked from tensorflow/datasets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
187 lines (165 loc) · 5.6 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
"""tensorflow/datasets is a library of datasets ready to use with TensorFlow.
tensorflow/datasets is a library of public datasets ready to use with
TensorFlow. Each dataset definition contains the logic necessary to download and
prepare the dataset, as well as to read it into a model using the
`tf.data.Dataset` API.
Usage outside of TensorFlow is also supported.
See the README on GitHub for further documentation.
"""
import datetime
import itertools
import os
import sys
from setuptools import find_packages
from setuptools import setup
nightly = False
if '--nightly' in sys.argv:
nightly = True
sys.argv.remove('--nightly')
project_name = 'tensorflow-datasets'
# To enable importing version.py directly, we add its path to sys.path.
version_path = os.path.join(
os.path.dirname(__file__), 'tensorflow_datasets')
sys.path.append(version_path)
from version import __version__ # pylint: disable=g-import-not-at-top
if nightly:
project_name = 'tfds-nightly'
datestring = (os.environ.get('TFDS_NIGHTLY_TIMESTAMP') or
datetime.datetime.now().strftime('%Y%m%d%H%M'))
__version__ += 'dev%s' % datestring
DOCLINES = __doc__.split('\n')
REQUIRED_PKGS = [
'absl-py',
'attrs',
'dill', # TODO(tfds): move to TESTS_REQUIRE.
'future',
'numpy',
'promise',
'protobuf>=3.6.1',
'requests>=2.19.0',
'six',
'tensorflow-metadata',
'termcolor',
'tqdm',
'wrapt',
]
TESTS_REQUIRE = [
'apache-beam',
'jupyter',
'mako',
'pytest',
'pytest-xdist',
# TODO(b/142892342): Re-enable
# 'tensorflow-docs @ git+https://github.com/tensorflow/docs#egg=tensorflow-docs', # pylint: disable=line-too-long
]
if sys.version_info.major == 3:
# Packages only for Python 3
pass
else:
# Packages only for Python 2
TESTS_REQUIRE.append('mock')
REQUIRED_PKGS.append('bz2file')
REQUIRED_PKGS.append('functools32')
REQUIRED_PKGS.append('futures') # concurrent.futures
if sys.version_info < (3, 4):
# enum introduced in Python 3.4
REQUIRED_PKGS.append('enum34')
if sys.version_info < (3, 3):
# shutil.disk_usage was introduced in Python 3.3, use psutil instead.
REQUIRED_PKGS.append('psutil')
# Static files needed by datasets.
DATASET_FILES = [
'image/caltech101_labels.txt',
'image/categories_places365.txt',
'image/cbis_ddsm_calc_distributions.txt',
'image/cbis_ddsm_calc_types.txt',
'image/cbis_ddsm_mass_margins.txt',
'image/cbis_ddsm_mass_shapes.txt',
'image/cbis_ddsm_patch_labels.txt',
'image/dtd_key_attributes.txt',
'image/food-101_classes.txt',
'image/imagenet2012_labels.txt',
'image/imagenet2012_validation_labels.txt',
'image/open_images_classes_all.txt',
'image/open_images_classes_boxable.txt',
'image/open_images_classes_trainable.txt',
'image/plant_leaves_urls.txt',
'image/plantae_k_urls.txt',
'image/quickdraw_labels.txt',
'image/sun397_labels.txt',
'image/sun397_tfds_te.txt',
'image/sun397_tfds_tr.txt',
'image/sun397_tfds_va.txt',
'url_checksums/*',
'video/ucf101_labels.txt',
]
# Extra dependencies required by specific datasets
DATASET_EXTRAS = {
# In alphabetical order
'aflw2k3d': ['scipy'],
'c4': ['apache_beam', 'langdetect', 'nltk', 'tldextract'],
'cats_vs_dogs': ['matplotlib'],
'colorectal_histology': ['Pillow'],
'eurosat': ['scikit-image',],
'groove': ['pretty_midi', 'pydub'],
'imagenet2012_corrupted': [
# This includes pre-built source; you may need to use an alternative
# route to install OpenCV
'opencv-python==3.4.0.14',
'scikit-image',
'scipy'
],
'librispeech': ['pydub'], # and ffmpeg installed
# sklearn version required to avoid conflict with librosa from
# https://github.com/scikit-learn/scikit-learn/issues/14485
'nsynth': ['crepe>=0.0.9', 'librosa', 'scikit-learn==0.20.3'],
'pet_finder': ['pandas'],
'svhn': ['scipy'],
'the300w_lp': ['scipy'],
'wider_face': ['Pillow'],
'wikipedia': ['mwparserfromhell', 'apache_beam'],
}
# Extra dataset deps are required for the tests
all_dataset_extras = list(itertools.chain.from_iterable(
deps for ds_name, deps in DATASET_EXTRAS.items() if ds_name != 'nsynth'))
EXTRAS_REQUIRE = {
'apache-beam': ['apache-beam'],
'matplotlib': ['matplotlib'],
'tensorflow': ['tensorflow>=1.15.0'],
'tensorflow_gpu': ['tensorflow-gpu>=1.15.0'],
# Tests dependencies are installed in ./oss_scripts/oss_pip_install.sh
# and run in ./oss_scripts/oss_tests.sh
'tests': TESTS_REQUIRE + all_dataset_extras,
# Nsynth is run in isolation, installed and run in
# ./oss_scripts/oss_tests.sh.
'tests_nsynth': TESTS_REQUIRE + DATASET_EXTRAS['nsynth'],
}
EXTRAS_REQUIRE.update(DATASET_EXTRAS)
setup(
name=project_name,
version=__version__,
description=DOCLINES[0],
long_description='\n'.join(DOCLINES[2:]),
author='Google Inc.',
author_email='[email protected]',
url='http://github.com/tensorflow/datasets',
download_url='https://github.com/tensorflow/datasets/tags',
license='Apache 2.0',
packages=find_packages(),
package_data={
'tensorflow_datasets': DATASET_FILES + [
'scripts/templates/*',
],
},
scripts=[],
install_requires=REQUIRED_PKGS,
extras_require=EXTRAS_REQUIRE,
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
],
keywords='tensorflow machine learning datasets',
)