-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
80 lines (71 loc) · 2.29 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
"""Install package."""
import io
import re
from pkg_resources import parse_requirements
from setuptools import find_packages, setup
def read_version(filepath: str) -> str:
"""Read the __version__ variable from the file.
Args:
filepath: probably the path to the root __init__.py
Returns:
the version
"""
match = re.search(
r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
io.open(filepath, encoding="utf_8_sig").read(),
)
if match is None:
raise SystemExit("Version number not found.")
return match.group(1)
# ease installation during development
vcs = re.compile(r"(git|svn|hg|bzr)\+")
try:
with open("requirements.txt") as fp:
VCS_REQUIREMENTS = [
str(requirement)
for requirement in parse_requirements(fp)
if vcs.search(str(requirement))
]
except FileNotFoundError:
# requires verbose flags to show
print("requirements.txt not found.")
VCS_REQUIREMENTS = []
setup(
name="survboard",
version=read_version("survboard/__init__.py"), # single place for version
description="Installable survboard package. Modify as needed.",
long_description=open("README.md").read(),
url="https://github.com/BoevaLab/survboard",
author="David Wissel, Nikita Janakarajan",
author_email="[email protected]",
# the following exclusion is to prevent shipping of tests.
# if you do include them, add pytest to the required packages.
packages=find_packages(".", exclude=["*tests*"]),
package_data={"survboard": ["py.typed"]},
extras_require={
"vcs": VCS_REQUIREMENTS,
"test": ["pytest", "pytest-cov"],
"dev": [
# tests
"pytest",
"pytest-cov",
# checks
"black==21.5b0",
"flake8",
"mypy",
# docs
"sphinx",
"sphinx-autodoc-typehints",
"better-apidoc",
"six",
"sphinx_rtd_theme",
"myst-parser",
],
},
install_requires=[
# versions should be very loose here, just exclude unsuitable versions
# because your dependencies also have dependencies and so on ...
# being too strict here will make dependency resolution harder
"click",
],
)