From 9853152f0bc841e467269bb5837f59f221b5637b Mon Sep 17 00:00:00 2001 From: Filipp Date: Tue, 19 Mar 2024 22:23:35 +0000 Subject: [PATCH 1/5] add pyproject.toml --- pyproject.toml | 29 +++++++++++++++++++++++++++++ setup.py | 47 +++++++++++++++-------------------------------- 2 files changed, 44 insertions(+), 32 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..399d3b7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools", "wheel", "Cython", "numpy"] +build-backend = "setuptools.build_meta" + +[project] +name = "ckwrap" +version = "1.2.0" +description = "Python wrapper for Ckmeans.1d.dp, 4.3.5." +authors = [{name = "djdt"}] +license = {file = "LICENSE"} +readme = "README.md" +urls = {Homepage = "https://github.com/djdt/ckwrap"} + +dependencies = [ + "numpy", + "Cython" +] +optional-dependencies = { + "test": ["pytest", "scipy"] +} + +[tool.cython] +# Cython specific settings, if any + +[tool.setuptools] +packages = ["ckwrap"] +package_dir = {"" = "."} +package_data = {"ckwrap": ["*.pxd"]} +zip_safe = false diff --git a/setup.py b/setup.py index 5b1e624..3475b1b 100644 --- a/setup.py +++ b/setup.py @@ -1,45 +1,28 @@ -from Cython.Build import cythonize from setuptools import setup, Extension import numpy as np +from Cython.Build import cythonize -with open("README.md") as fp: - long_description = fp.read() - -sources = [ - "ckwrap/_ckwrap.pyx", - "Ckmeans.1d.dp/src/dynamic_prog.cpp", - "Ckmeans.1d.dp/src/EWL2_dynamic_prog.cpp", - "Ckmeans.1d.dp/src/EWL2_fill_log_linear.cpp", - "Ckmeans.1d.dp/src/EWL2_fill_quadratic.cpp", - "Ckmeans.1d.dp/src/EWL2_fill_SMAWK.cpp", - "Ckmeans.1d.dp/src/fill_log_linear.cpp", - "Ckmeans.1d.dp/src/fill_quadratic.cpp", - "Ckmeans.1d.dp/src/fill_SMAWK.cpp", - "Ckmeans.1d.dp/src/select_levels.cpp", - "Ckmeans.1d.dp/src/weighted_select_levels.cpp", -] - +# Extension definition remains similar to your current setup.py ckwrap = Extension( name="_ckwrap", - sources=sources, + sources=[ + "ckwrap/_ckwrap.pyx", + "Ckmeans.1d.dp/src/dynamic_prog.cpp", + "Ckmeans.1d.dp/src/EWL2_dynamic_prog.cpp", + "Ckmeans.1d.dp/src/EWL2_fill_log_linear.cpp", + "Ckmeans.1d.dp/src/EWL2_fill_quadratic.cpp", + "Ckmeans.1d.dp/src/EWL2_fill_SMAWK.cpp", + "Ckmeans.1d.dp/src/fill_log_linear.cpp", + "Ckmeans.1d.dp/src/fill_quadratic.cpp", + "Ckmeans.1d.dp/src/fill_SMAWK.cpp", + "Ckmeans.1d.dp/src/select_levels.cpp", + "Ckmeans.1d.dp/src/weighted_select_levels.cpp", + ], language="c++", include_dirs=["Ckmeans.1d.dp/src", np.get_include()], extra_compile_args=["-std=c++11", "-g0"], ) - setup( - name="ckwrap", - version="1.2.0", - description="Python wrapper for Ckmeans.1d.dp, 4.3.5.", - long_description=long_description, - long_description_content_type="text/markdown", - author="djdt", - license="LGPL", - url="https://github.com/djdt/ckwrap", - packages=["ckwrap"], - package_data={"ckwrap": ["*.pxd"]}, ext_modules=cythonize(ckwrap), - install_requires=["numpy", "Cython"], - tests_require=["pytest", "scipy"], ) From f14ec80ab0554304203d0c7ec039ec21000e2753 Mon Sep 17 00:00:00 2001 From: Filipp Date: Tue, 19 Mar 2024 22:27:57 +0000 Subject: [PATCH 2/5] qwe --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 399d3b7..42b45bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,9 +19,6 @@ optional-dependencies = { "test": ["pytest", "scipy"] } -[tool.cython] -# Cython specific settings, if any - [tool.setuptools] packages = ["ckwrap"] package_dir = {"" = "."} From d1867c6a4c0ed017b6b31dfc8c4b19a0ce17923d Mon Sep 17 00:00:00 2001 From: Filipp Date: Tue, 19 Mar 2024 22:30:22 +0000 Subject: [PATCH 3/5] qwe --- pyproject.toml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 42b45bf..843aa94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,12 +15,4 @@ dependencies = [ "numpy", "Cython" ] -optional-dependencies = { - "test": ["pytest", "scipy"] -} - -[tool.setuptools] -packages = ["ckwrap"] -package_dir = {"" = "."} -package_data = {"ckwrap": ["*.pxd"]} -zip_safe = false +optional-dependencies = {"test" = ["pytest", "scipy"]} From 4279e972975589b502131e6f9d7dd886afd4d982 Mon Sep 17 00:00:00 2001 From: Filipp Date: Tue, 19 Mar 2024 22:45:15 +0000 Subject: [PATCH 4/5] fix --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 843aa94..d4a1d88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,3 +16,6 @@ dependencies = [ "Cython" ] optional-dependencies = {"test" = ["pytest", "scipy"]} + +[tool.setuptools] +packages = ["ckwrap"] From 728f6c80d345031f92febeddd22bc04a8d225931 Mon Sep 17 00:00:00 2001 From: djdt <10266332+djdt@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:48:26 +1100 Subject: [PATCH 5/5] Update pyproject.toml bump version, use subtables --- pyproject.toml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d4a1d88..7b3e37f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,18 +4,24 @@ build-backend = "setuptools.build_meta" [project] name = "ckwrap" -version = "1.2.0" +version = "1.2.1" +dependencies = [ + "numpy", + "Cython", +] description = "Python wrapper for Ckmeans.1d.dp, 4.3.5." authors = [{name = "djdt"}] license = {file = "LICENSE"} readme = "README.md" -urls = {Homepage = "https://github.com/djdt/ckwrap"} -dependencies = [ - "numpy", - "Cython" +[project.urls] +Homepage = "https://github.com/djdt/ckwrap" + +[project.optional-dependencies] +test = [ + "pytest", + "scipy", ] -optional-dependencies = {"test" = ["pytest", "scipy"]} [tool.setuptools] packages = ["ckwrap"]