-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathsetup.py
110 lines (101 loc) · 4.01 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
# Copyright 2018 Google LLC. All Rights Reserved.
#
# 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.
# ==============================================================================
"""Build pip wheel for model_converter."""
import os
import setuptools
from tensorflowjs import version
DIR_NAME = os.path.dirname(__file__)
def _get_requirements(file):
"Reads the requirements file and returns the packages"
with open(os.path.join(DIR_NAME, file), 'r') as requirements:
return requirements.readlines()
def get_extra_requires(path, add_all=True):
import re
from collections import defaultdict
with open(path) as fp:
extra_deps = defaultdict(set)
for k in fp:
if k.strip() and not k.startswith('#'):
tags = set()
if ':' in k:
k, v = k.split(':')
tags.update(vv.strip() for vv in v.split(','))
tags.add(re.split('[<=>]', k)[0])
for t in tags:
extra_deps[t].add(k)
# add tag `all` at the end
if add_all:
extra_deps['all'] = set(vv for v in extra_deps.values() for vv in v)
return extra_deps
CONSOLE_SCRIPTS = [
'tensorflowjs_converter = tensorflowjs.converters.converter:pip_main',
'tensorflowjs_wizard = tensorflowjs.converters.wizard:pip_main',
]
setuptools.setup(
name='tensorflowjs',
version=version.version,
description='Python Libraries and Tools for TensorFlow.js',
url='https://js.tensorflow.org/',
author='Google LLC',
author_email='[email protected]',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: JavaScript',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'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',
],
py_modules=[
'tensorflowjs',
'tensorflowjs.version',
'tensorflowjs.quantization',
'tensorflowjs.read_weights',
'tensorflowjs.resource_loader',
'tensorflowjs.write_weights',
'tensorflowjs.converters',
'tensorflowjs.converters.common',
'tensorflowjs.converters.converter',
'tensorflowjs.converters.fold_batch_norms',
'tensorflowjs.converters.fuse_depthwise_conv2d',
'tensorflowjs.converters.fuse_prelu',
'tensorflowjs.converters.graph_rewrite_util',
'tensorflowjs.converters.keras_h5_conversion',
'tensorflowjs.converters.keras_tfjs_loader',
'tensorflowjs.converters.jax_conversion',
'tensorflowjs.converters.tf_saved_model_conversion_v2',
'tensorflowjs.converters.wizard',
],
include_package_data=True,
packages=['tensorflowjs/op_list'],
package_data={
'tensorflowjs/op_list': ['*.json']
},
install_requires=_get_requirements('requirements.txt'),
extras_require=get_extra_requires('extra-requirements.txt'),
entry_points={
'console_scripts': CONSOLE_SCRIPTS,
},
license='Apache 2.0',
keywords='tensorflow javascript machine deep learning converter',
)