From dafeddebb08e4dc8884e3f10be582b24f81db1bb Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 3 Jan 2024 07:38:28 -0800 Subject: [PATCH] Add support for python 3.11+ The cython generated C code is different for 3.11 vs 3.10, so relying on pip using an sdist with that file included doesn't work. That is to say, that "pip install sha256" doesn't work on 3.11 with the 0.3 release on pypi. This change updates setup.py to the current recommendation from cython (which removes the sdist step). It adds a pyproject.toml so that cython is recognized as a build-time dependency in recent pip versions. Package classifiers are updated to include 3.11 and 3.12, and dropping the EOL 3.7. Finally the sha256 package version is updated to 1.0 to prepare for a future release. --- pyproject.toml | 2 ++ setup.cfg | 3 ++- setup.py | 18 +++--------------- sha256.pyx | 2 +- 4 files changed, 8 insertions(+), 17 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3254f38 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[build-system] +requires = ["setuptools", "cython"] diff --git a/setup.cfg b/setup.cfg index 67d1100..95c74da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,10 +9,11 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 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 project_urls = Source = https://github.com/cloudtools/sha256 Tracker = https://github.com/cloudtools/sha256/issues diff --git a/setup.py b/setup.py index 2b3462e..2714a0f 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,14 @@ from setuptools import setup -from setuptools.extension import Extension -from setuptools.command.sdist import sdist as _sdist - -cmdclass = {} - - -class sdist(_sdist): - def run(self): - from Cython.Build import cythonize - cythonize(['sha256.pyx']) - _sdist.run(self) -cmdclass['sdist'] = sdist +from Cython.Build import cythonize setup( name='sha256', - version='0.3', + version='1.0', description='sha256 library with midstate', author='Mark Peek', author_email='mark@peek.org', license="MIT", - cmdclass=cmdclass, - ext_modules=[Extension("sha256", ["sha256.c"])], + ext_modules=cythonize(['sha256.pyx']), test_suite="tests", ) diff --git a/sha256.pyx b/sha256.pyx index 14b2710..ef0f87b 100644 --- a/sha256.pyx +++ b/sha256.pyx @@ -7,7 +7,7 @@ import struct from libc.stdint cimport uint64_t, uint32_t, uint8_t -__version__ = "0.3" +__version__ = "1.0" cdef uint32_t k[64]