-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathsetup.py
More file actions
175 lines (157 loc) · 5.14 KB
/
setup.py
File metadata and controls
175 lines (157 loc) · 5.14 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import codecs
import os
import re
import sys
from setuptools import Distribution, find_packages, setup
try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
except ImportError:
_bdist_wheel = None
python_version = sys.version_info
if python_version < (3, 8):
sys.exit("Python < 3.8 is not supported, aborting setup")
NAME = "compas_python_utils"
DIST_NAME = "compas-popsynth"
PACKAGES = find_packages()
HERE = os.path.dirname(os.path.realpath(__file__))
META_PATH = os.path.join(NAME, "__init__.py")
CPP_VERSION_FILE = os.path.join("src", "changelog.h")
BUILD_BINARY_WHEEL = os.environ.get("COMPAS_BINARY_WHEEL") == "1"
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]
CORE_RUNTIME_REQUIRES = [
"numpy>=1.16",
"PyYAML",
]
ANALYSIS_REQUIRES = [
"h5py",
"stroopwafel",
"matplotlib>=3.3.2",
"pandas",
"astropy>=4.0",
"scipy>=1.5.0",
"tqdm",
"corner",
]
DEV_ONLY_REQUIRES = [
"pytest>=3.6",
"pytest-cov",
"pre-commit",
"flake8",
"black==22.10.0",
"isort",
"coverage-badge",
"deepdiff",
"jupytext",
"jupyter-autotime",
"memory_profiler",
"nbconvert",
"ipykernel",
]
EXTRA_REQUIRE = dict(
docs=[
"sphinx>=7.0.1",
"numpydoc",
"nbsphinx",
"sphinx_rtd_theme>=1.2.2",
"sphinx-tabs",
"sphinx-argparse",
"sphinx-math-dollar>=1.2",
"sphinxcontrib.bibtex",
"linuxdoc",
"ipython",
"readthedocs-sphinx-search>=0.1.1b",
"sphinx-togglebutton",
"linuxdoc>=20210324"
],
full=[],
dev=DEV_ONLY_REQUIRES,
gpu=["cupy"],
)
class COMPASDistribution(Distribution):
def has_ext_modules(self):
return BUILD_BINARY_WHEEL
cmdclass = {}
if BUILD_BINARY_WHEEL and _bdist_wheel is not None:
class COMPASBdistWheel(_bdist_wheel):
def finalize_options(self):
super().finalize_options()
self.root_is_pure = False
def get_tag(self):
_, _, platform_tag = super().get_tag()
return "py3", "none", platform_tag
cmdclass["bdist_wheel"] = COMPASBdistWheel
def read(*parts):
with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
return f.read()
def find_meta(meta, meta_file=read(META_PATH)):
meta_match = re.search(
r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), meta_file, re.M
)
if meta_match:
return meta_match.group(1)
raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
def find_version(version_file=read(CPP_VERSION_FILE)):
version_match = re.search(
r"VERSION_STRING = ['\"]([^'\"]*)['\"]", version_file, re.M
)
if version_match:
raw_version = version_match.group(1)
normalized_parts = [str(int(part)) for part in raw_version.split(".")]
return ".".join(normalized_parts)
raise RuntimeError("Unable to find version string.")
if __name__ == "__main__":
setup(
name=DIST_NAME,
version=find_version(),
author=find_meta("author"),
author_email=find_meta("email"),
maintainer=find_meta("author"),
maintainer_email=find_meta("email"),
url=find_meta("uri"),
license=find_meta("license"),
description=find_meta("description"),
long_description=read("README.md"),
long_description_content_type="text/markdown",
packages=PACKAGES,
python_requires=">=3.8",
package_data={
NAME: [
"bundled/*",
"bundled/*/*.sh",
"bundled/*/bin/*",
"bundled/*/lib/*",
],
f"{NAME}.preprocessing": ["*.txt", "*.yaml"],
f"{NAME}.detailed_evolution_plotter": ["van_den_heuvel_figures/*"],
f"{NAME}.cosmic_integration": ["SNR_Grid*"],
},
include_package_data=True,
install_requires=CORE_RUNTIME_REQUIRES + ANALYSIS_REQUIRES,
extras_require=EXTRA_REQUIRE,
classifiers=CLASSIFIERS,
zip_safe=not BUILD_BINARY_WHEEL,
distclass=COMPASDistribution,
cmdclass=cmdclass,
entry_points={
"console_scripts": [
f"compas_h5view= {NAME}.h5view:main",
f"compas_h5copy= {NAME}.h5copy:main",
f"compas_h5sample= {NAME}.h5sample:main",
f"compas_plot_detailed_evolution={NAME}.detailed_evolution_plotter.plot_detailed_evolution:main",
f"compas_run={NAME}.compas_runner:main",
f"compas_run_submit={NAME}.preprocessing.runSubmit:main",
f"compas_sample_stroopwafel={NAME}.preprocessing.stroopwafelInterface:main",
f"compas_sample_moe_di_stefano={NAME}.preprocessing.sampleMoeDiStefano:main",
f"compas_fast_cosmic_integrator={NAME}.cosmic_integration.FastCosmicIntegration:main",
]
},
)