From f7629cda1242a09b1ea1335fd859ad5563414e06 Mon Sep 17 00:00:00 2001 From: William Silversmith Date: Wed, 3 Jul 2024 15:26:38 -0400 Subject: [PATCH 1/3] fix: setup.py + set language level for cython --- python/zfpy.pxd | 2 ++ python/zfpy.pyx | 2 ++ setup.py | 24 ++++++++++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/python/zfpy.pxd b/python/zfpy.pxd index c92c29833..067bd90a4 100644 --- a/python/zfpy.pxd +++ b/python/zfpy.pxd @@ -1,3 +1,5 @@ +# cython: language_level=3 + import cython cimport libc.stdint as stdint from libc.stddef cimport ptrdiff_t diff --git a/python/zfpy.pyx b/python/zfpy.pyx index 0b7a19e1c..0d1eb5230 100644 --- a/python/zfpy.pyx +++ b/python/zfpy.pyx @@ -1,3 +1,5 @@ +# cython: language_level=3 + import sys import operator import functools diff --git a/setup.py b/setup.py index fa2da6efc..544ae2918 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,31 @@ from setuptools import setup, Extension -import numpy as np + +class NumpyImport: + def __repr__(self): + import numpy as np + + return np.get_include() + + __fspath__ = __repr__ setup( name="zfpy", + setup_requires=["numpy", "cython"], version="1.0.1", author="Peter Lindstrom, Danielle Asher", author_email="zfp@llnl.gov", url="https://zfp.llnl.gov", description="zfp compression in Python", long_description="zfp is a compressed format for representing multidimensional floating-point and integer arrays. zfp provides compressed-array classes that support high throughput read and write random access to individual array elements. zfp also supports serial and parallel compression of whole arrays using both lossless and lossy compression with error tolerances. zfp is primarily written in C and C++ but also includes Python and Fortran bindings.", - ext_modules=[Extension("zfpy", ["build/python/zfpy.c"], - include_dirs=["include", np.get_include()], - libraries=["zfp"], library_dirs=["build/lib64", "build/lib/Release"]), language_level = "3"] + ext_modules=[ + Extension( + "zfpy", + sources=["python/zfpy.pyx"], + include_dirs=["include", str(NumpyImport())], + libraries=["zfp"], + library_dirs=["build/lib64", "build/lib/Release"], + language_level=3, + lanugage="c", + ), + ], ) From 1e669e5067883ad93e06bf4be5341a0ab04e9dae Mon Sep 17 00:00:00 2001 From: William Silversmith Date: Wed, 3 Jul 2024 15:30:14 -0400 Subject: [PATCH 2/3] chore: add trove classifiers --- setup.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/setup.py b/setup.py index 544ae2918..90b37865c 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,7 @@ def __repr__(self): author="Peter Lindstrom, Danielle Asher", author_email="zfp@llnl.gov", url="https://zfp.llnl.gov", + license="License :: OSI Approved :: BSD License", description="zfp compression in Python", long_description="zfp is a compressed format for representing multidimensional floating-point and integer arrays. zfp provides compressed-array classes that support high throughput read and write random access to individual array elements. zfp also supports serial and parallel compression of whole arrays using both lossless and lossy compression with error tolerances. zfp is primarily written in C and C++ but also includes Python and Fortran bindings.", ext_modules=[ @@ -28,4 +29,20 @@ def __repr__(self): lanugage="c", ), ], + classifiers=[ + "Intended Audience :: Developers", + "Development Status :: 4 - Beta", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Image Processing", + "Topic :: System :: Archiving :: Compression", + "Operating System :: POSIX", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows :: Windows 10", + ], ) From e7ece11af79e7eb202dd6efb1e612eb7c2336fdc Mon Sep 17 00:00:00 2001 From: William Silversmith Date: Wed, 3 Jul 2024 15:41:18 -0400 Subject: [PATCH 3/3] install: add MANIFEST.in and pyproject.toml --- MANIFEST.in | 6 ++++++ pyproject.toml | 8 ++++++++ 2 files changed, 14 insertions(+) create mode 100644 MANIFEST.in create mode 100644 pyproject.toml diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..a34c60c68 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include python/zfpy.pxd +include python/zfpy.pyx +recursive-include include *.h +recursive-include src *.c *.h +include LICENSE +include pyproject.toml \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..f43c81a75 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,8 @@ +[build-system] +requires = [ + "setuptools", + "wheel", + "cython", + "oldest-supported-numpy; python_version<'3.9'", + 'numpy; python_version>="3.9"', +] \ No newline at end of file