-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
83 lines (75 loc) · 2.95 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
import site
import os
import typing as tp
from setuptools import Extension # type: ignore
from setuptools import setup
from pathlib import Path
AK_VERSION = '0.9.0'
def get_long_description() -> str:
return '''The ArrayKit library provides utilities for creating and transforming NumPy arrays, implementing performance-critical StaticFrame operations as Python C extensions.
Code: https://github.com/static-frame/arraykit
Packages: https://pypi.org/project/arraykit
'''
# NOTE: we do this to avoid importing numpy: https://stackoverflow.com/questions/54117786/add-numpy-get-include-argument-to-setuptools-without-preinstalled-numpy
# we used to import the following to get directories:
# from numpy.distutils.misc_util import get_info
# import numpy as np # type: ignore
# get_info('npymath')['library_dirs']
# get_info('npymath')['libraries']
def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]:
dirs = []
for sp in site.getsitepackages():
fp = os.path.join(sp, *components)
if os.path.exists(fp):
dirs.append(fp)
return dirs
ak_extension = Extension(
name='arraykit._arraykit', # build into module
sources=[
'src/_arraykit.c',
'src/array_go.c',
'src/array_to_tuple.c',
'src/block_index.c',
'src/delimited_to_arrays.c',
'src/methods.c',
'src/tri_map.c',
],
include_dirs=get_ext_dir('numpy', '_core', 'include') + ['src'],
library_dirs=get_ext_dir('numpy', '_core', 'lib'),
define_macros=[("AK_VERSION", AK_VERSION)],
libraries=['npymath'], # not including mlib at this time
)
setup(
name='arraykit',
version=AK_VERSION,
description='Array utilities for StaticFrame',
long_description=get_long_description(),
python_requires='>=3.9',
install_requires=['numpy>=1.19.5'],
url='https://github.com/static-frame/arraykit',
author='Christopher Ariza, Brandt Bucher, Charles Burkland',
license='MIT',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development',
"Programming Language :: C",
"Programming Language :: Python :: Implementation :: CPython",
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Typing :: Typed',
],
keywords='numpy array',
packages=['arraykit'],
package_dir={'arraykit': 'src'},
package_data={'arraykit': ['__init__.pyi', 'py.typed']},
include_package_data=True,
ext_modules=[ak_extension],
)