-
Notifications
You must be signed in to change notification settings - Fork 22
/
setup.py
116 lines (101 loc) · 3.67 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
"""
package setup
"""
import codecs
import io
import os
import re
from typing import Dict, List
from setuptools import find_packages, setup
HERE = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an encoding option to open
return codecs.open(os.path.join(HERE, *parts), "r").read()
def read_requirements(*parts) -> List[str]:
"""
Return requirements from parts.
Given a requirements.txt (or similar style file),
returns a list of requirements.
Assumes anything after a single '#' on a line is a comment, and ignores
empty lines.
:param parts: list of filenames which contain the installation "parts",
i.e. submodule-specific installation requirements
:returns: A compiled list of requirements.
"""
requirements = []
for line in read(*parts).splitlines():
new_line = re.sub( # noqa: PD005
r"(\s*)?#.*$", # the space immediately before the
# hash mark, the hash mark, and
# anything that follows it
"", # replace with a blank string
line,
)
new_line = re.sub( # noqa: PD005
r"-r.*$", # link to another requirement file
"", # replace with a blank string
new_line,
)
new_line = re.sub( # noqa: PD005
r"-e \..*$", # link to editable install
"", # replace with a blank string
new_line,
)
# print(line, "-->", new_line)
if new_line: # i.e. we have a non-zero-length string
requirements.append(new_line)
return requirements
INSTALL_REQUIRES: List[str] = read_requirements(".requirements/base.in")
EXTRA_REQUIRES: Dict[str, List[str]] = {
"rxn": read_requirements(".requirements/base.in")
+ read_requirements(".requirements/rxn.in"),
"graphs": read_requirements(".requirements/base.in")
+ read_requirements(".requirements/graphs.in"),
"dev": read_requirements(".requirements/dev.in"),
"docs": read_requirements(".requirements/docs.in"),
}
# Add all requires
all_requires: List[str] = []
for k, v in EXTRA_REQUIRES.items():
if k not in ["dev", "docs"]:
all_requires.extend(v)
EXTRA_REQUIRES["all"] = list(set(all_requires))
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M
)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
version = find_version("gauche", "__init__.py")
readme = open("README.md").read()
packages = find_packages(".", exclude=["tests"])
setup(
name="gauche",
version=version,
description="Gaussian Process Library for Molecules, Chemical Reactions and Proteins.",
long_description=readme,
long_description_content_type="text/markdown",
license="MIT",
keywords="machine-learning gaussian-processes kernels pytorch chemistry biology protein ligand",
packages=packages,
include_package_data=True,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRA_REQUIRES,
python_requires=">=3.8",
platforms="any",
classifiers=[
"License :: OSI Approved :: MIT License",
"Development Status :: 5 - Production/Stable",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
],
)