-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
executable file
·37 lines (29 loc) · 1.09 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
import os
from pathlib import Path
from setuptools import find_packages, setup
THIS_DIR = Path(__file__).parent
def _get_version(filename):
from re import findall
with open(filename) as f:
metadata = dict(findall("__([a-z]+)__ = '([^']+)'", f.read()))
return metadata['version']
def _load_requirements(path_dir=THIS_DIR, comment_char='#'):
with open(os.path.join(path_dir, 'requirements.txt'), '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)]
if ln: # if requirement is not empty
reqs.append(ln)
return reqs
setup(
name='full_stack_transformer',
version=_get_version('full_stack_transformer/__init__.py'),
description='Language Models trainer.',
packages=find_packages(exclude=['tests', 'tests.*']),
install_requires=_load_requirements(THIS_DIR),
package_dir={'full_stack_transformer': 'full_stack_transformer'},
package_data={'full_stack_transformer': ['tasks/static/*']}
)