-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
68 lines (60 loc) · 2.18 KB
/
Copy pathsetup.py
File metadata and controls
68 lines (60 loc) · 2.18 KB
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
import os
import codecs
import re
from setuptools import setup, find_packages
current_path = os.path.abspath(os.path.dirname(__file__))
def parse_ver_as_float(ver):
return float('.'.join(ver.split('.')[:2]))
def get_requirements_dynamic():
requires = []
try:
import tensorflow
if parse_ver_as_float(tensorflow.__version__) < 2.2:
raise ImportError
except:
requires.append('tensorflow>=2.2.0')
try:
import tensorflow_probability
if parse_ver_as_float(tensorflow_probability.__version__) < 0.10:
raise ImportError
except:
requires.append('tensorflow-probability>=0.10.0')
try:
import tensorflow_addons
if parse_ver_as_float(tensorflow_addons.__version__) < 0.10:
raise ImportError
except:
requires.append('tensorflow-addons>=0.10.0')
requires.append('numpy')
requires.append('six >= 1.10.0')
def read_file(*parts):
with codecs.open(os.path.join(current_path, *parts), 'r', 'utf8') as reader:
return reader.read()
def get_requirements(*parts):
with codecs.open(os.path.join(current_path, *parts), 'r', 'utf8') as reader:
return list(map(lambda x: x.strip(), reader.readlines()))
def find_version(*file_paths):
version_file = read_file(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to find version string.')
setup(
name="dynastes",
version=find_version('dynastes', '__init__.py'),
author="Team Dynastes",
author_email="v3qt0r@gmail.com",
description="A collection of layers and utils for TensorFlow (Keras) 2.+",
long_description=read_file('README.md'),
long_description_content_type="text/markdown",
url="https://github.com/dynastes-team/dynastes",
install_requires=get_requirements_dynamic(),
packages=find_packages(),
classifiers=[
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)