From 7918334b05c0c13797d37f9c7f3b8dab2c6ffe51 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 00:14:51 +0100 Subject: [PATCH 01/16] Build python 3.13 --- .github/workflows/build.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee7d4de..e9dec82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,7 @@ name: Build wheels on: workflow_dispatch: + push: jobs: build_wheels: @@ -28,7 +29,7 @@ jobs: - name: Build wheels env: - CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-* cp312-*' + CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*' CIBW_ARCHS_MACOS: x86_64 arm64 CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686 # skip PyPy, musllinux, 32-bit Linux run: | @@ -81,9 +82,9 @@ jobs: path: dist/ # https://github.com/pypa/gh-action-pypi-publish - - name: Publish Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06 - with: - skip-existing: true - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} +# - name: Publish Python distribution to PyPI +# uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06 +# with: +# skip-existing: true +# user: __token__ +# password: ${{ secrets.PYPI_API_TOKEN }} From d6ecc93e9e45ff01fe0355428a2b47e6f386226c Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 00:21:59 +0100 Subject: [PATCH 02/16] Added tests for python 3.13 --- .github/workflows/test_base.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_base.yml b/.github/workflows/test_base.yml index e015ad8..bce9fcd 100644 --- a/.github/workflows/test_base.yml +++ b/.github/workflows/test_base.yml @@ -2,6 +2,7 @@ name: Build & test on: workflow_call: + push: jobs: build: @@ -10,7 +11,7 @@ jobs: fail-fast: false # Allow one of the matrix builds to fail without failing others matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Checkout From 15dabfc01c9d6957d5ac3b56103f1b1c09833601 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 00:23:30 +0100 Subject: [PATCH 03/16] Added python 3.13 marker --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 499add5..6f8283f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] [project.urls] From a5146f12dd905abcbec2abf76913bfe19d0beb64 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 00:31:23 +0100 Subject: [PATCH 04/16] Test building with 3.12 --- .github/workflows/build.yml | 4 ++-- .github/workflows/build_docs.yml | 2 +- .readthedocs.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e9dec82..7768994 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.12 - name: Install cibuildwheel run: | @@ -53,7 +53,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.12 - name: Install build run: python -m pip install build diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index e8f7b14..6abbd65 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -15,7 +15,7 @@ jobs: - name: Setup python uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.12 - name: Install packages run: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 774b067..09342d9 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.12" # Build documentation in the docs/ directory with Sphinx sphinx: From dbdc8a5484290ba9dc1883eaa436fa6456bcd56c Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 00:38:39 +0100 Subject: [PATCH 05/16] Test building with 3.13 --- .github/workflows/build.yml | 4 ++-- .github/workflows/build_docs.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7768994..01ebf46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.12 + python-version: 3.13 - name: Install cibuildwheel run: | @@ -53,7 +53,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.12 + python-version: 3.13 - name: Install build run: python -m pip install build diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 6abbd65..46ac378 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -15,7 +15,7 @@ jobs: - name: Setup python uses: actions/setup-python@v4 with: - python-version: 3.12 + python-version: 3.13 - name: Install packages run: | From 2651a282504613f9a2ad2a19f717b3e2798671a3 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 00:40:11 +0100 Subject: [PATCH 06/16] Test building with 3.13 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01ebf46..ed5e719 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,8 +24,8 @@ jobs: - name: Install cibuildwheel run: | - pip install --upgrade pip - pip install cibuildwheel==2.15.0 + pip install --upgrade pip Cython setuptools wheel + pip install cibuildwheel==2.21.3 - name: Build wheels env: From b1b2224a63a3ce4df84e0221264e161f0e454ad6 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:13:24 +0100 Subject: [PATCH 07/16] Fixed some type conversion problems --- KDEpy/cutils_ext/cutils.pyx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/KDEpy/cutils_ext/cutils.pyx b/KDEpy/cutils_ext/cutils.pyx index 024b144..5901079 100644 --- a/KDEpy/cutils_ext/cutils.pyx +++ b/KDEpy/cutils_ext/cutils.pyx @@ -26,7 +26,7 @@ from libc.math cimport floor # for nor correctly handle negative indices # cdivision(True) -> If set to False, Cython will adjust the remainder and -# quotient operators C types to match those of Python ints (which differ +# quotient operators C types to match those of Pyethon ints (which differ # when the operands have opposite signs) and raise a ZeroDivisionError # when the right operand is 0 @cython.boundscheck(False) @@ -213,7 +213,7 @@ def iterate_data_ND(double[:, :] data, double[:] result, long[:] grid_num, grid_num : number of grid points in each dimension obs_tot : total number of observations (grid points) binary_flgs : array of shape (dims, 2**dims), counting in binary - this is used to to go every corner point efficiently + this is used to go every corner point efficiently """ cdef int obs, result_index, i, dims, corners, j, flg, corner, integer_xi cdef double corner_value, fraction @@ -223,7 +223,7 @@ def iterate_data_ND(double[:, :] data, double[:] result, long[:] grid_num, obs, dims = data.shape[0], data.shape[1] # For every dimension, there are two directions to find corners in - corners = 2**dims + corners = int(2**dims) # Loop through every data point for i in range(obs): @@ -246,11 +246,11 @@ def iterate_data_ND(double[:, :] data, double[:] result, long[:] grid_num, # Since we use flags to indicate x_1 or x_1 + 1, the following # code does the job: result_index = int(x_i[0]) - result_index += 0**binary_flgs[corner, 0] + result_index += int(0**binary_flgs[corner, 0]) for j in range(1, dims): result_index *= grid_num[j] integer_xi = floor(x_i[j]) - result_index += (integer_xi + 0**binary_flgs[corner, j]) + result_index += (integer_xi + int(0**binary_flgs[corner, j])) # (2) The value is found by # PROD_{i=0} (1 - frac(x[i))**flg * frac(x[i]) ** (1 - flg) @@ -281,7 +281,7 @@ def iterate_data_ND_weighted(double[:, :] data, double[:] weights, double[:] res cdef double[:] x_i obs, dims = data.shape[0], data.shape[1] - corners = 2**dims + corners = int(2**dims) for i in range(obs): x_i = data[i, :] @@ -290,11 +290,11 @@ def iterate_data_ND_weighted(double[:, :] data, double[:] weights, double[:] res for corner in range(corners): result_index = int(x_i[0]) - result_index += 0**binary_flgs[corner, 0] + result_index += int(0**binary_flgs[corner, 0]) for j in range(1, dims): result_index *= grid_num[j] integer_xi = floor(x_i[j]) - result_index += (integer_xi + 0**binary_flgs[corner, j]) + result_index += (integer_xi + int(0**binary_flgs[corner, j])) corner_value = 1.0 for j in range(dims): From e8a1ec93083a846c35d6adae639ec33624527903 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:14:18 +0100 Subject: [PATCH 08/16] Reverted lots of version changes --- .github/workflows/build.yml | 4 ++-- .github/workflows/build_docs.yml | 2 +- .readthedocs.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed5e719..ac4e77f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.13 + python-version: 3.11 - name: Install cibuildwheel run: | @@ -53,7 +53,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.13 + python-version: 3.11 - name: Install build run: python -m pip install build diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 46ac378..e8f7b14 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -15,7 +15,7 @@ jobs: - name: Setup python uses: actions/setup-python@v4 with: - python-version: 3.13 + python-version: 3.11 - name: Install packages run: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 09342d9..774b067 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.12" + python: "3.11" # Build documentation in the docs/ directory with Sphinx sphinx: From e86514e5635d1f26cc11faa01fa9ba4dbaa786c9 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:15:49 +0100 Subject: [PATCH 09/16] Changed compiler directive --- .github/workflows/test_base.yml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_base.yml b/.github/workflows/test_base.yml index bce9fcd..2efbb96 100644 --- a/.github/workflows/test_base.yml +++ b/.github/workflows/test_base.yml @@ -25,7 +25,7 @@ jobs: - name: Install run: | pip install pip --upgrade - pip install -e .[dev,test,lint] + pip install -e .[dev,test,lint] --verbose - name: Run tests and linting run: | diff --git a/setup.py b/setup.py index 2f8460e..a848f2d 100644 --- a/setup.py +++ b/setup.py @@ -15,5 +15,5 @@ packages=["KDEpy"], cmdclass={"build_ext": build_ext}, include_dirs=[np.get_include()], - ext_modules=[Extension("KDEpy._cutils", ["KDEpy/cutils_ext/cutils.pyx"])], + ext_modules=[Extension("KDEpy._cutils", ["KDEpy/cutils_ext/cutils.pyx"], compiler_directives={"language_level": "3"},)], verbose=True ) From 4ff602d70f04b21147bbb3e4e911002406e8eade Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:20:49 +0100 Subject: [PATCH 10/16] Changed compiler level --- .github/workflows/build.yml | 2 +- pyproject.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac4e77f..e95f957 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: - name: Build wheels env: - CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*' + CIBW_BUILD: 'cp312-* cp313-*' CIBW_ARCHS_MACOS: x86_64 arm64 CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686 # skip PyPy, musllinux, 32-bit Linux run: | diff --git a/pyproject.toml b/pyproject.toml index 6f8283f..f0ea6fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,3 +46,6 @@ lint = [ [build-system] requires = ["setuptools>=45", "wheel", "cython>=0.29,<1.0.0", "oldest-supported-numpy"] build-backend = "setuptools.build_meta" + +[tool.cython] +language_level = "3" \ No newline at end of file From f02a8f4f0c963e8261e73c113077930a7116aae6 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:20:55 +0100 Subject: [PATCH 11/16] Changed compiler level --- .github/workflows/test_base.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_base.yml b/.github/workflows/test_base.yml index 2efbb96..a0f54a2 100644 --- a/.github/workflows/test_base.yml +++ b/.github/workflows/test_base.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false # Allow one of the matrix builds to fail without failing others matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.12', '3.13'] #'3.8', '3.9', '3.10', '3.11', steps: - name: Checkout From 523f2d11a82796f4e2f6d032035b2d459d00ee32 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:22:08 +0100 Subject: [PATCH 12/16] Changed compiler level --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e95f957..69cdcd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.13 - name: Install cibuildwheel run: | From be9785396139dbdaf9d46582a82f3497ab4bbbc4 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:38:08 +0100 Subject: [PATCH 13/16] Update to cython --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f0ea6fe..052746e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ lint = [ ] [build-system] -requires = ["setuptools>=45", "wheel", "cython>=0.29,<1.0.0", "oldest-supported-numpy"] +requires = ["setuptools>=45", "wheel", "cython>=3.0,<4.0", "oldest-supported-numpy"] build-backend = "setuptools.build_meta" [tool.cython] From 196c09ad85134be061a5d5debf4bd254c6483e34 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:44:59 +0100 Subject: [PATCH 14/16] Reverted experimental changes --- .github/workflows/build.yml | 19 +++++++++---------- .github/workflows/test_base.yml | 5 ++--- pyproject.toml | 3 --- setup.py | 7 ++++++- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69cdcd8..082e12d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,6 @@ name: Build wheels on: workflow_dispatch: - push: jobs: build_wheels: @@ -20,16 +19,16 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.13 + python-version: 3.11 - name: Install cibuildwheel run: | - pip install --upgrade pip Cython setuptools wheel + pip install --upgrade pip pip install cibuildwheel==2.21.3 - name: Build wheels env: - CIBW_BUILD: 'cp312-* cp313-*' + CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*' CIBW_ARCHS_MACOS: x86_64 arm64 CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686 # skip PyPy, musllinux, 32-bit Linux run: | @@ -82,9 +81,9 @@ jobs: path: dist/ # https://github.com/pypa/gh-action-pypi-publish -# - name: Publish Python distribution to PyPI -# uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06 -# with: -# skip-existing: true -# user: __token__ -# password: ${{ secrets.PYPI_API_TOKEN }} + - name: Publish Python distribution to PyPI + uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06 + with: + skip-existing: true + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test_base.yml b/.github/workflows/test_base.yml index a0f54a2..0fcb47d 100644 --- a/.github/workflows/test_base.yml +++ b/.github/workflows/test_base.yml @@ -2,7 +2,6 @@ name: Build & test on: workflow_call: - push: jobs: build: @@ -11,7 +10,7 @@ jobs: fail-fast: false # Allow one of the matrix builds to fail without failing others matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.12', '3.13'] #'3.8', '3.9', '3.10', '3.11', + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Checkout @@ -25,7 +24,7 @@ jobs: - name: Install run: | pip install pip --upgrade - pip install -e .[dev,test,lint] --verbose + pip install -e .[dev,test,lint] - name: Run tests and linting run: | diff --git a/pyproject.toml b/pyproject.toml index 052746e..338e4f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,3 @@ lint = [ [build-system] requires = ["setuptools>=45", "wheel", "cython>=3.0,<4.0", "oldest-supported-numpy"] build-backend = "setuptools.build_meta" - -[tool.cython] -language_level = "3" \ No newline at end of file diff --git a/setup.py b/setup.py index a848f2d..d335590 100644 --- a/setup.py +++ b/setup.py @@ -7,13 +7,18 @@ https://github.com/pypa/sampleproject """ +from Cython.Build import cythonize import numpy as np from Cython.Distutils import build_ext from setuptools import Extension, setup +print("MEssage to mee") + setup( packages=["KDEpy"], cmdclass={"build_ext": build_ext}, include_dirs=[np.get_include()], - ext_modules=[Extension("KDEpy._cutils", ["KDEpy/cutils_ext/cutils.pyx"], compiler_directives={"language_level": "3"},)], verbose=True + ext_modules=cythonize( + [Extension("KDEpy._cutils", ["KDEpy/cutils_ext/cutils.pyx"])], + ), ) From 29f9ed1b49428cb1e1c7a61f01764ab8c484d65d Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 01:46:27 +0100 Subject: [PATCH 15/16] Reverted experimental changes --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index d335590..c854d92 100644 --- a/setup.py +++ b/setup.py @@ -12,8 +12,6 @@ from Cython.Distutils import build_ext from setuptools import Extension, setup -print("MEssage to mee") - setup( packages=["KDEpy"], cmdclass={"build_ext": build_ext}, From c462b70f2639943c912363d9f611847891eb5aa2 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 29 Oct 2024 02:01:02 +0100 Subject: [PATCH 16/16] Update cutils.pyx --- KDEpy/cutils_ext/cutils.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KDEpy/cutils_ext/cutils.pyx b/KDEpy/cutils_ext/cutils.pyx index 5901079..f03ce20 100644 --- a/KDEpy/cutils_ext/cutils.pyx +++ b/KDEpy/cutils_ext/cutils.pyx @@ -26,7 +26,7 @@ from libc.math cimport floor # for nor correctly handle negative indices # cdivision(True) -> If set to False, Cython will adjust the remainder and -# quotient operators C types to match those of Pyethon ints (which differ +# quotient operators C types to match those of Python ints (which differ # when the operands have opposite signs) and raise a ZeroDivisionError # when the right operand is 0 @cython.boundscheck(False) @@ -412,4 +412,4 @@ def grid_is_sorted(double[:, :] grid): if not grid_is_sorted(grid[row_start_index:, 1:]): return False - return True \ No newline at end of file + return True