/ concept-collection / benchcompress
Sign in
concept-collection / benchcompress
benchcompress / zia_benchmark / setup.py
75 lines · 2.4 KBBlameHistoryRaw
1from setuptools import setup, find_packages
2from setuptools.command.build_ext import build_ext
3from setuptools import Extension
4import os
5import sys
6import subprocess
8class CMakeExtension(Extension):
9 def __init__(self, name, sourcedir=""):
10 Extension.__init__(self, name, sources=[])
11 self.sourcedir = os.path.abspath(sourcedir)
13class CMakeBuild(build_ext):
14 def build_extension(self, ext):
15 extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
17 cmake_args = [
18 f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}",
19 f"-DPYTHON_EXECUTABLE={sys.executable}"
20 ]
22 build_args = []
24 if not os.path.exists(self.build_temp):
25 os.makedirs(self.build_temp)
27 subprocess.check_call(["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp)
28 subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=self.build_temp)
30setup(
31 name="zia_benchmark",
32 version="0.1.0",
33 packages=find_packages(where="src"),
34 package_dir={"": "src"},
35 install_requires=[
36 "numpy",
37 "scipy",
38 "zstandard",
39 "simple_ans",
40 "requests",
41 "lindi",
42 "brotli",
43 "click",
44 "pybind11>=2.11.1"
45 ],
46 ext_modules=[
47 CMakeExtension("zia_benchmark.algorithms.simple_ans.markov_reconstruct_cpp_ext",
48 sourcedir="src/zia_benchmark/algorithms/simple_ans"),
49 CMakeExtension("zia_benchmark.algorithms.simple_ans.markov_predict_cpp_ext",
50 sourcedir="src/zia_benchmark/algorithms/simple_ans")
51 ],
52 cmdclass={
53 "build_ext": CMakeBuild,
54 },
55 python_requires=">=3.8",
56 entry_points={
57 "console_scripts": [
58 "zia-benchmark=zia_benchmark.cli:main",
59 ],
60 },
61 author="Jeremy Magland",
62 description="Benchmarking compression methods for numeric arrays",
63 long_description=open("README.md").read(),
64 long_description_content_type="text/markdown",
65 keywords="compression, signal processing",
66 classifiers=[
67 "Development Status :: 3 - Alpha",
68 "Intended Audience :: Science/Research",
69 "Programming Language :: Python :: 3",
70 "Programming Language :: Python :: 3.8",
71 "Programming Language :: Python :: 3.9",
72 "Programming Language :: Python :: 3.10",
73 "Programming Language :: Python :: 3.11"
74 ],
moveopenescclose