forked from bihealth/snappy-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
132 lines (111 loc) · 4.12 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
125
126
127
128
129
130
131
132
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Installation driver (and development utility entry point) for snappy-pipeline
"""
from itertools import chain
import os
import sys
from setuptools import find_packages, setup
import versioneer
__author__ = "Manuel Holtgrewe <[email protected]>"
def parse_requirements(path):
"""Parse ``requirements.txt`` at ``path``."""
requirements = []
with open(path, "rt") as reqs_f:
for line in reqs_f:
line = line.strip()
if line.startswith("-r"):
fname = line.split()[1]
inner_path = os.path.join(os.path.dirname(path), fname)
requirements += parse_requirements(inner_path)
elif line != "" and not line.startswith("#"):
requirements.append(line)
return requirements
# Enforce python version >=3.7
if sys.version_info < (3, 7):
print("At least Python 3.7 is required.\n", file=sys.stderr)
sys.exit(1)
with open("README.rst") as readme_file:
readme = readme_file.read()
with open("HISTORY.rst") as history_file:
history = history_file.read()
# Get requirements
requirements = parse_requirements("requirements/base.txt")
test_requirements = [
# TODO: put package test requirements here
]
# Name of the tools
TOOLS = (
"bed_filter_jaccard",
"bam_cov_stats",
"fix_vcf",
"genome_windows",
"quickvenn",
"vcf_first_header",
"vcf_filter_denovo",
"vcf_filter_from_info",
"vcf_filter_to_info",
"ped_to_vcf_header",
)
# Name of the scripts
SCRIPTS = ("snappy-transfer_utils", "snappy-vcf_sort", "snappy-vcf_split")
def console_scripts_entry_points(names, module):
"""Yield entries for the 'console_scripts' entry points"""
prefix = "snappy"
for name in names:
if module == "wrappers":
yield "{prefix}-{name} = snappy_wrappers.{module}.{name}.__main__:main".format(
prefix=prefix, name=name, module=module
)
elif module == "tools":
yield "{prefix}-{name} = snappy_wrappers.{module}.{name}:main".format(
prefix=prefix, name=name, module=module
)
def bash_scripts(names):
"""Return generator with bash scripts of the given ``names``"""
return (os.path.join("scripts", name) for name in names)
setup(
name="snappy-pipeline",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="SNAPPY Nucleic Acid Processing in Python (by CUBI)",
long_description=readme + "\n\n" + history,
author="Manuel Holtgrewe",
author_email="[email protected]",
url="https://github.com/bihealth/snappy-pipeline",
packages=find_packages(),
package_dir={"snappy_wrappers": "snappy_wrappers", "snappy_pipeline": "snappy_pipeline"},
entry_points={
"console_scripts": list(
chain(
(
"snappy-pull-sheet = snappy_pipeline.apps.snappy_pull_sheet:main",
"snappy-snake = snappy_pipeline.apps.snappy_snake:main",
"snappy-start-project = snappy_pipeline.apps.snappy_start_project:main",
"snappy-start-step = snappy_pipeline.apps.snappy_start_step:main",
"snappy-refresh-step = snappy_pipeline.apps.snappy_refresh_step:main",
"snappy-slurm-status = snappy_pipeline.apps.snappy_slurm_status:main",
),
console_scripts_entry_points(TOOLS, "tools"),
)
)
},
scripts=tuple(bash_scripts(SCRIPTS)),
include_package_data=True,
install_requires=requirements,
license="MIT license",
zip_safe=False,
keywords="bioinformatics",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
test_suite="tests",
tests_require=test_requirements,
)