-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
113 lines (88 loc) · 3.65 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
"""holodeck: Massive black hole (MBH) binary simulator for pulsar timing array signals.
To build cython library in-place:
$ python setup.py build_ext -i
"""
from os.path import abspath, join
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
import numpy as np
# ---- Prepare Meta-Data ----
# NOTE: `short_description` gets first line of `__doc__` only (linebreaks not allowed by setuptools)
short_description = __doc__.strip().split('\n')[0]
with open(join('.', "README.md"), "r") as handle:
long_description = handle.read()
with open(join('.', "requirements.txt"), "r") as handle:
requirements = handle.read()
with open(join('.', 'holodeck', 'version.txt')) as handle:
version = handle.read().strip()
# ---- Handle cython submodules ----
ext_cyutils = Extension(
"holodeck.cyutils", # specify the resulting name/location of compiled extension
sources=[join('.', 'holodeck', 'cyutils.pyx')], # location of source code
# define parameters external libraries
include_dirs=[
np.get_include()
],
library_dirs=[
abspath(join(np.get_include(), '..', '..', 'random', 'lib')),
abspath(join(np.get_include(), '..', 'lib'))
],
libraries=['npyrandom', 'npymath'],
# Silence some undesired warnings
define_macros=[('NPY_NO_DEPRECATED_API', 0)],
extra_compile_args=['-Wno-unreachable-code-fallthrough', '-Wno-unused-function'],
)
ext_sam_cyutils = Extension(
"holodeck.sams.sam_cyutils", # specify the resulting name/location of compiled extension
sources=[join('.', 'holodeck', 'sams', 'sam_cyutils.pyx')], # location of source code
# define parameters external libraries
include_dirs=[
np.get_include()
],
library_dirs=[
abspath(join(np.get_include(), '..', '..', 'random', 'lib')),
abspath(join(np.get_include(), '..', 'lib'))
],
libraries=['npyrandom', 'npymath'],
# Silence some undesired warnings
define_macros=[('NPY_NO_DEPRECATED_API', 0)],
extra_compile_args=['-Wno-unreachable-code-fallthrough', '-Wno-unused-function'],
)
cython_modules = cythonize(
[ext_cyutils, ext_sam_cyutils],
compiler_directives={"language_level": "3"},
annotate=True, # create html output about cython files
)
# ---- Perform Setup ----
setup(
name='holodeck-gw',
author='NANOGrav',
author_email='[email protected]',
description=short_description,
long_description=long_description,
long_description_content_type="text/markdown",
version=version,
license='MIT',
url="https://github.com/NANOGrav/holodeck/",
# External dependencies loaded from 'requirements.txt'
install_requires=requirements,
# Which Python importable modules should be included when your package is installed
# Handled automatically by setuptools. Use 'exclude' to prevent some specific
# subpackage(s) from being added, if needed
packages=find_packages(),
# Optional include package data to ship with your package
# Customize MANIFEST.in if the general case does not suit your needs
# Comment out this line to prevent the files from being packaged with your software
include_package_data=True,
# Additional entries you may want simply uncomment the lines you want and fill in the data
# url='http://www.my_package.com', # Website
python_requires=">=3.9", # Python version restrictions
ext_modules=cython_modules,
entry_points = {
"console_scripts": [
'holodeck_lib_gen = holodeck.librarian.gen_lib:main',
'holodeck_fit_spec = holodeck.librarian.fit_spectra:main',
],
},
)