forked from amphibian-dev/toad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
81 lines (64 loc) · 2.22 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
import os
import numpy as np
from setuptools import setup, find_packages, Extension
NAME = 'toad'
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__))
VERSION_FILE = os.path.join(CURRENT_PATH, NAME, 'version.py')
def get_version():
ns = {}
with open(VERSION_FILE) as f:
exec(f.read(), ns)
return ns['__version__']
def get_ext_modules():
from Cython.Build import cythonize
extensions = [
Extension('toad.c_utils', sources = ['toad/c_utils.pyx'], include_dirs = [np.get_include()]),
Extension('toad.merge', sources = ['toad/merge.pyx'], include_dirs = [np.get_include()]),
]
return cythonize(extensions)
def get_requirements(stage = None):
file_name = 'requirements'
if stage is not None:
file_name = f"{file_name}-{stage}"
requirements = []
with open(f"{file_name}.txt", 'r') as f:
for line in f:
line = line.strip()
if not line or line.startswith('-'):
continue
requirements.append(line)
return requirements
setup(
name = NAME,
version = get_version(),
description = 'Toad is dedicated to facilitating model development process, especially for a scorecard.',
long_description = open('README.md', encoding = 'utf-8').read(),
long_description_content_type = 'text/markdown',
url = 'https://github.com/amphibian-dev/toad',
author = 'ESC Team',
author_email = '[email protected]',
packages = find_packages(exclude = ['tests']),
include_dirs = [np.get_include()],
ext_modules = get_ext_modules(),
include_package_data = True,
python_requires = '>=3.6',
install_requires = get_requirements(),
extras_require = {
'nn': get_requirements('nn')
},
tests_require = get_requirements('test'),
license = 'MIT',
classifiers = [
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
entry_points = {
'console_scripts': [
'toad = toad.cli:main',
],
},
)