diff --git a/libtiff/libtiff_ctypes.py b/libtiff/libtiff_ctypes.py index be13a3a..977554e 100644 --- a/libtiff/libtiff_ctypes.py +++ b/libtiff/libtiff_ctypes.py @@ -21,6 +21,13 @@ __all__ = ['libtiff', 'TIFF'] +SCTYPES = { + "float": [np.float16, np.float32, np.float64], + "uint": [np.uint8, np.uint16, np.uint32, np.uint64, np.bool_], + "int": [np.int8, np.int16, np.int32, np.int64], + "complex": [np.complex64, np.complex128], +} + cwd = os.getcwd() try: os.chdir(os.path.dirname(__file__)) @@ -729,13 +736,13 @@ def write_image(self, arr, compression=None, write_rgb=False): compression = self._fix_compression(compression) arr = np.ascontiguousarray(arr) - if arr.dtype in np.sctypes['float']: + if arr.dtype in SCTYPES["float"]: sample_format = SAMPLEFORMAT_IEEEFP - elif arr.dtype in np.sctypes['uint'] + [np.bool_]: + elif arr.dtype in SCTYPES["uint"]: sample_format = SAMPLEFORMAT_UINT - elif arr.dtype in np.sctypes['int']: + elif arr.dtype in SCTYPES["int"]: sample_format = SAMPLEFORMAT_INT - elif arr.dtype in np.sctypes['complex']: + elif arr.dtype in SCTYPES["complex"]: sample_format = SAMPLEFORMAT_COMPLEXIEEEFP else: raise NotImplementedError(repr(arr.dtype)) @@ -816,13 +823,13 @@ def write_tiles(self, arr, tile_width=None, tile_height=None, compression=None, write_rgb=False): compression = self._fix_compression(compression) - if arr.dtype in np.sctypes['float']: + if arr.dtype in SCTYPES["float"]: sample_format = SAMPLEFORMAT_IEEEFP - elif arr.dtype in np.sctypes['uint'] + [np.bool_]: + elif arr.dtype in SCTYPES["uint"]: sample_format = SAMPLEFORMAT_UINT - elif arr.dtype in np.sctypes['int']: + elif arr.dtype in SCTYPES["int"]: sample_format = SAMPLEFORMAT_INT - elif arr.dtype in np.sctypes['complex']: + elif arr.dtype in SCTYPES["complex"]: sample_format = SAMPLEFORMAT_COMPLEXIEEEFP else: raise NotImplementedError(repr(arr.dtype)) diff --git a/pyproject.toml b/pyproject.toml index c11d76c..ee92722 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=60", "wheel", "setuptools_scm[toml]>=8.0", 'oldest-supported-numpy'] +requires = ["setuptools>=60", "wheel", "setuptools_scm[toml]>=8.0", "numpy>=2.0"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] diff --git a/setup.py b/setup.py index 6551723..d745669 100644 --- a/setup.py +++ b/setup.py @@ -28,10 +28,10 @@ def setup_package(): "Intended Audience :: Science/Research", "License :: OSI Approved", "Programming Language :: Python", - "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", "Topic :: Software Development", "Operating System :: Microsoft :: Windows", @@ -42,8 +42,8 @@ def setup_package(): description='PyLibTiff: a Python tiff library.', long_description=long_description, long_description_content_type='text/markdown', - install_requires=['numpy>=1.13.3'], - python_requires='>=3.8', + install_requires=['numpy>=1.24.5'], + python_requires='>=3.9', extras_require={ 'bitarray': ['bitarray'], },