-
Notifications
You must be signed in to change notification settings - Fork 25
/
setup.py
115 lines (109 loc) · 2.99 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
import os
import sys
import numpy as np
from Cython.Build import cythonize
from setuptools import Extension, find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
if sys.platform == "win32":
allocator_libs = [] # type: ignore
extra_compile_args = ["/openmp", "/O2"]
extra_link_args = ["/openmp"]
elif sys.platform == "darwin":
allocator_libs = ["jemalloc"]
extra_compile_args = [
"-Xpreprocessor",
"-fopenmp",
"-O3",
"-ffast-math",
"--std=c++17",
]
extra_link_args = ["-lomp"]
else:
allocator_libs = ["jemalloc"]
extra_compile_args = [
"-fopenmp",
"-O3",
"-ffast-math",
"--std=c++17",
]
extra_link_args = ["-fopenmp"]
extension_args = dict(
include_dirs=[np.get_include()],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
language="c++",
)
ext_modules = [
Extension(
name="glum._functions",
sources=["src/glum/_functions.pyx"],
**extension_args,
),
Extension(
name="glum._cd_fast",
sources=["src/glum/_cd_fast.pyx"],
**extension_args,
),
]
setup(
name="glum",
use_scm_version={"version_scheme": "post-release"},
setup_requires=["setuptools_scm"],
description="High performance Python GLMs with all the features!",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/Quantco/glum",
author="QuantCo, Inc.",
author_email="[email protected]",
license="BSD",
classifiers=[ # Optional
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
package_dir={"": "src"},
packages=find_packages(
where="src",
include=(
["glum"] if os.environ.get("CONDA_BUILD") else ["glum", "glum_benchmarks"]
),
),
python_requires=">=3.9",
install_requires=[
"joblib",
"numexpr",
"numpy",
"pandas",
"scikit-learn>=0.23",
"scipy",
"formulaic>=0.6",
"tabmat>=4.0.0",
],
entry_points=(
None
if os.environ.get("CONDA_BUILD")
else """
[console_scripts]
glm_benchmarks_run = glum_benchmarks.cli_run:cli_run
glm_benchmarks_analyze = glum_benchmarks.cli_analyze:cli_analyze
"""
),
ext_modules=cythonize(
ext_modules,
annotate=False,
compiler_directives={
"language_level": "3",
"boundscheck": False,
"wraparound": False,
"initializedcheck": False,
"nonecheck": False,
"cdivision": True,
"legacy_implicit_noexcept": True,
},
),
zip_safe=False,
)