From b829bab8a113970b5d12fadd4d99849cbe893657 Mon Sep 17 00:00:00 2001 From: Alexey C <54956904+ColdTeapot273K@users.noreply.github.com> Date: Tue, 18 Jul 2023 11:17:55 +0500 Subject: [PATCH 1/3] add pyproject.toml --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4faef68 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[build-system] +requires = ["cython", "numpy", "setuptools", "wheel"] From d582c9f4902a86aadbd4a535ab5811fc03b7ca7a Mon Sep 17 00:00:00 2001 From: Alexey C <54956904+ColdTeapot273K@users.noreply.github.com> Date: Tue, 18 Jul 2023 11:18:03 +0500 Subject: [PATCH 2/3] update setup.py --- setup.py | 65 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index ccf4868..6a22287 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,56 @@ -from distutils.core import setup -from distutils.extension import Extension -from Cython.Distutils import build_ext -import numpy -from Cython.Build import cythonize +# import numpy +# from Cython.Build import cythonize +import subprocess +import sys + +import setuptools # type: ignore +from setuptools import Extension, setup + +try: + from numpy import __version__ as numpy_version + from numpy import get_include +except ImportError: + subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy"]) + from numpy import __version__ as numpy_version + from numpy import get_include + +try: + from Cython.Build import cythonize +except ImportError: + subprocess.check_call([sys.executable, "-m", "pip", "install", "Cython"]) + from Cython.Build import cythonize # type: ignore -setup( - name='choldate', - version='0.1.0', - packages=['choldate','choldate.test'], - cmdclass = {'build_ext': build_ext}, - ext_modules = cythonize([Extension("choldate._choldate", ["choldate/_choldate.pyx"],include_dirs = [numpy.get_include()]) - ]), requires=['numpy','cython'] +ext_modules = cythonize([Extension("choldate._choldate", ["choldate/_choldate.pyx"], include_dirs=[get_include()])]) + +# ext_modules = ( +# cythonize( +# module_list=[ +# setuptools.Extension( +# "*", +# sources=["**/*.pyx"], +# include_dirs=[get_include()], +# ) +# ], +# compiler_directives={ +# "language_level": 3, +# "binding": True, +# "embedsignature": True, +# }, +# ), +# ) + +setup( + name="choldate", + version="0.1.0", + # packages=["choldate", "choldate.test"], + packages=setuptools.find_packages(), + include_package_data=True, + # ext_modules=cythonize(extensions), + ext_modules=ext_modules, + # include_dirs=[numpy.get_include()], + # install_requires=["numpy", "cython"], + # install_requires=(base_packages := [f"numpy>={numpy_version}", "cython"]), + install_requires=(base_packages := [f"numpy>={numpy_version}"]), + zip_safe=False, ) From d37246f4fc1775f11b84d42b5ceba08e6392d285 Mon Sep 17 00:00:00 2001 From: Alexey C <54956904+ColdTeapot273K@users.noreply.github.com> Date: Tue, 18 Jul 2023 11:18:46 +0500 Subject: [PATCH 3/3] cleanup setup.py --- setup.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/setup.py b/setup.py index 6a22287..e681bfe 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -# import numpy -# from Cython.Build import cythonize import subprocess import sys @@ -23,34 +21,12 @@ ext_modules = cythonize([Extension("choldate._choldate", ["choldate/_choldate.pyx"], include_dirs=[get_include()])]) -# ext_modules = ( -# cythonize( -# module_list=[ -# setuptools.Extension( -# "*", -# sources=["**/*.pyx"], -# include_dirs=[get_include()], -# ) -# ], -# compiler_directives={ -# "language_level": 3, -# "binding": True, -# "embedsignature": True, -# }, -# ), -# ) - setup( name="choldate", version="0.1.0", - # packages=["choldate", "choldate.test"], packages=setuptools.find_packages(), include_package_data=True, - # ext_modules=cythonize(extensions), ext_modules=ext_modules, - # include_dirs=[numpy.get_include()], - # install_requires=["numpy", "cython"], - # install_requires=(base_packages := [f"numpy>={numpy_version}", "cython"]), install_requires=(base_packages := [f"numpy>={numpy_version}"]), zip_safe=False, )