This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
setup.py
91 lines (76 loc) · 2.81 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
"""Setup script."""
import os
import pathlib
import re
from setuptools import setup, find_packages
# Set the environment variable TF_CPU (to anything) to use tensorflow-cpu
_TENSORFLOW_CPU = os.environ.get('TF_CPU', None)
# TensorFlow package name and version
_TENSORFLOW = 'tensorflow' if _TENSORFLOW_CPU is None else 'tensorflow-cpu'
_MIN_TENSORFLOW_VERSION = '2.2'
_TENSORFLOW += f'>={_MIN_TENSORFLOW_VERSION}'
# Directory of this setup.py file
_HERE = pathlib.Path(__file__).parent
def _resolve_path(*parts):
"""Get a filename from a list of path components, relative to this file."""
return _HERE.joinpath(*parts).absolute()
def _read(*parts):
"""Read a file's contents into a string."""
filename = _resolve_path(*parts)
return filename.read_text()
__INIT__ = _read('src', 'focal_loss', '__init__.py')
def _get_package_variable(name):
pattern = rf'^{name} = [\'"](?P<value>[^\'"]*)[\'"]'
match = re.search(pattern, __INIT__, flags=re.M)
if match:
return match.group('value')
raise RuntimeError(f'Cannot find variable {name}')
setup(
name=_get_package_variable('__package__'),
version=_get_package_variable('__version__'),
description=_get_package_variable('__description__'),
url=_get_package_variable('__url__'),
author=_get_package_variable('__author__'),
author_email=_get_package_variable('__author_email__'),
long_description=_read('README.rst'),
long_description_content_type='text/x-rst',
packages=find_packages('src', exclude=['*.tests']),
package_dir={'': 'src'},
license='Apache 2.0',
classifiers=[
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
install_requires=[
_TENSORFLOW,
],
extras_require={
# The 'dev' extra is for development, including running tests and
# generating documentation
'dev': [
'numpy',
'scipy',
'matplotlib',
'seaborn',
'pytest',
'coverage',
'sphinx',
'sphinx_rtd_theme',
],
},
zip_safe=False,
)