-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
58 lines (51 loc) · 1.97 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
import os
import sys
from typing import List
from setuptools import find_packages, setup
# copied from pytorch-lightning
_PATH_ROOT = os.path.dirname(__file__)
_PATH_REQUIRE = os.path.join(_PATH_ROOT, 'requirements')
def _load_requirements(path_dir: str, file_name: str = 'requirements.txt', comment_char: str = '#') -> List[str]:
"""Load requirements from a file
>>> _load_requirements(_PROJECT_ROOT) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['numpy...', 'torch...', ...]
"""
with open(os.path.join(path_dir, file_name), 'r') as file:
lines = [ln.strip() for ln in file.readlines()]
reqs = []
for ln in lines:
# filer all comments
if comment_char in ln:
ln = ln[:ln.index(comment_char)].strip()
# skip directly installed dependencies
if ln.startswith('http'):
continue
if ln: # if requirement is not empty
reqs.append(ln)
return reqs
# https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras
# Define package extras. These are only installed if you specify them.
# From remote, use like `pip install pytorch-lightning[dev, docs]`
# From local copy of repo, use like `pip install ".[dev, docs]"`
extras = {
'examples': _load_requirements(path_dir=_PATH_REQUIRE, file_name='examples.txt'),
'test': _load_requirements(path_dir=_PATH_REQUIRE, file_name='test.txt')
}
extras['dev'] = extras['examples'] + extras['test']
extras['all'] = extras['dev']
setup(
name='xynn',
version='0.1',
description='A collection of Tabular NN models with a Scikit-learn API',
url='https://github.com/jrfiedler/xynn',
author='James Fiedler',
author_email='[email protected]',
license='MIT',
python_requires=">=3.7",
packages=find_packages(exclude=['tests','tests/*',]),
zip_safe=False,
keywords=['deep learning', 'pytorch', 'AI'],
setup_requires=[],
install_requires=_load_requirements(_PATH_ROOT),
extras_require=extras,
)