-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
109 lines (98 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
"""Package setup for climbing_ratings"""
# Copyright Contributors to the Climbing Ratings project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, Extension
from Cython.Build import cythonize
import numpy
# setuptools.Extension kwargs for building Cython extensions.
cython_ext = {
"extra_compile_args": [
"-Ofast",
"-ffast-math",
"-fno-math-errno",
"-Wno-deprecated-declarations",
],
"define_macros": [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
"include_dirs": [numpy.get_include()],
}
csum = Extension(
"climbing_ratings.csum",
["climbing_ratings/csum.pyx"],
# Disable some maths optimizations that defeat precision-preserving
# ordering.
extra_compile_args=(cython_ext["extra_compile_args"] + ["-fno-associative-math"]),
define_macros=cython_ext["define_macros"],
)
bradley_terry = Extension(
"climbing_ratings.bradley_terry",
["climbing_ratings/bradley_terry.pyx"],
**cython_ext,
)
derivatives = Extension(
"climbing_ratings.derivatives",
["climbing_ratings/derivatives.pyx"],
**cython_ext,
)
slices = Extension(
"climbing_ratings.slices",
["climbing_ratings/slices.pyx"],
**cython_ext,
)
long_description = """
climbing_ratings is a library for estimating ratings for the sport of rock
climbing. The ratings can be used to predict route difficulty and climber
performance on a particular route.
The algorithms are based on the Whole-History Rating system."""
if __name__ == "__main__":
setup(
name="climbing_ratings",
author="Dean Scarff",
author_email=("dos" + chr(64) + "scarff.id.au"),
description="Estimate climber and route ratings from ascents data",
long_description=long_description,
version="4.2.3",
url="https://github.com/p00ya/climbing_ratings",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
],
license="Apache License 2.0",
packages=["climbing_ratings", "climbing_ratings.tests"],
include_package_data=False,
package_data={"climbing_ratings": ["*.pyi", "*.pyx"]},
platforms=["POSIX"],
python_requires=">=3.9",
install_requires=["numpy>=2.0.0"],
setup_requires=["Cython>=3.0.0", "numpy>=2.0.0"],
test_suite="climbing_ratings.tests.test_suite",
tests_require=["numpy", "pytest"],
ext_modules=cythonize(
[csum, bradley_terry, derivatives, slices],
compiler_directives={
"language_level": 3,
"boundscheck": False,
"cdivision": True,
"embedsignature": True,
"initializedcheck": False,
"nonecheck": False,
"wraparound": False,
},
),
)