-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
124 lines (111 loc) · 3.47 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
import os
# import re
# import ast
import setuptools # type: ignore
from setuptools.extension import Extension # type: ignore
from Cython.Build import cythonize # type: ignore
# _version_re = re.compile(r'VERSION\s+=\s+(.*)')
#
# with open('codfreq/version.py', 'rb') as f:
# version = str(ast.literal_eval(_version_re.search(
# f.read().decode('utf-8')).group(1)))
extensions = [
Extension(
name='codfreq.samfile_helper',
sources=['codfreq/samfile_helper.py']
),
Extension(
name='codfreq.paired_reads',
sources=['codfreq/paired_reads.py'],
# define_macros=[('CYTHON_TRACE', '1')]
),
Extension(
name='codfreq.posnas',
sources=['codfreq/posnas.py'],
# define_macros=[('CYTHON_TRACE', '1')]
),
Extension(
name='codfreq.poscodons',
sources=['codfreq/poscodons.py'],
# define_macros=[('CYTHON_TRACE', '1')]
),
Extension(
name='codfreq.sam2codfreq',
sources=['codfreq/sam2codfreq.py'],
# define_macros=[('CYTHON_TRACE', '1')]
),
Extension(
name='codfreq.codonalign_consensus',
sources=['codfreq/codonalign_consensus.py'],
# define_macros=[('CYTHON_TRACE', '1')]
),
Extension(
name='codfreq.sam2consensus',
sources=['codfreq/sam2consensus.py'],
# define_macros=[('CYTHON_TRACE', '1')]
)
]
def strip_comments(line: str) -> str:
return line.split('#', 1)[0].strip()
def pep508(line: str) -> str:
if line.startswith('-i '):
return ''
if not line:
return line
if '://' in line and 'post-align' in line:
url = line.split('#egg=', 1)
return 'post-align @ {}'.format(url[0].strip())
return line
def req(filename: str) -> list[str]:
with open(os.path.join(os.getcwd(), filename)) as fp:
requires = set(
strip_comments(pep508(ln))
for ln in fp.readlines()
)
requires -= set([''])
return list(requires)
setup_params = dict(
name="codfreq",
version="0.2",
url="https://github.com/hivdb/codfreq",
author='Philip Tzou',
author_email="philiptz@stanford.edu",
packages=[
'codfreq', 'codfreq/cmdwrappers'
],
package_data={
'codfreq': ['py.typed']
},
install_requires=req('requirements.txt'),
ext_modules=cythonize(
extensions,
compiler_directives={
'language_level': '3',
'profile': False,
'linetrace': False
}
),
# tests_require=reqs('test-requirements.txt'),
# include_package_data=True,
entry_points={'console_scripts': [
'fastq2codfreq = codfreq.align:align_cmd',
'compress-codfreq = codfreq.compress_codfreq:compress_codfreq',
'make-response = codfreq.make_response:make_response'
]},
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Scientific/Engineering :: Bio-Informatics'],
# test_suite="nose.collector",
zip_safe=True)
if __name__ == '__main__':
setuptools.setup(**setup_params)