[Git][debian-gis-team/pykdtree][upstream] New upstream version 1.3.13+ds

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Sat Sep 7 17:02:31 BST 2024



Antonio Valentino pushed to branch upstream at Debian GIS Project / pykdtree


Commits:
a30ed48e by Antonio Valentino at 2024-09-07T15:53:02+00:00
New upstream version 1.3.13+ds
- - - - -


5 changed files:

- .github/workflows/deploy-wheels.yml
- CHANGELOG.md
- pykdtree/kdtree.pyx
- pykdtree/test_tree.py
- setup.py


Changes:

=====================================
.github/workflows/deploy-wheels.yml
=====================================
@@ -36,7 +36,7 @@ jobs:
           - os: windows-2019
             cibw_archs: "AMD64 ARM64"
             artifact_name: "win"
-          - os: macos-11
+          - os: macos-12
             cibw_archs: "x86_64 arm64"
             artifact_name: "mac"
           - os: "ubuntu-20.04"
@@ -58,13 +58,16 @@ jobs:
           platforms: all
 
       - name: Build wheels
-        uses: pypa/cibuildwheel at v2.17.0
+        uses: pypa/cibuildwheel at v2.20.0
         env:
           CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *i686 *-musllinux_aarch64"
           CIBW_ARCHS: "${{ matrix.cibw_archs }}"
           CIBW_TEST_COMMAND: "pytest -v --pyargs pykdtree"
           CIBW_TEST_REQUIRES: "pytest"
           CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64"
+          # we use openmp (libomp) from homebrew which has a current limit of
+          # macos 12 (Monterey): https://formulae.brew.sh/formula/libomp
+          CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=12
 
       - name: Upload wheel(s) as build artifacts
         uses: actions/upload-artifact at v4
@@ -103,7 +106,7 @@ jobs:
           path: dist
       - name: Publish package to PyPI
         if: github.event.action == 'published'
-        uses: pypa/gh-action-pypi-publish at v1.8.14
+        uses: pypa/gh-action-pypi-publish at v1.10.0
         with:
           user: ${{ secrets.pypi_username }}
           password: ${{ secrets.pypi_password }}


=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,25 @@
+## Version 1.3.13 (2024/09/04)
+
+### Issues Closed
+
+* [Issue 116](https://github.com/storpipfugl/pykdtree/issues/116) - Segmentation fault on empty points ([PR 119](https://github.com/storpipfugl/pykdtree/pull/119) by [@STNLd2](https://github.com/STNLd2))
+
+In this release 1 issue was closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 119](https://github.com/storpipfugl/pykdtree/pull/119) - Fixed empty pts segfault ([116](https://github.com/storpipfugl/pykdtree/issues/116))
+
+#### Features added
+
+* [PR 124](https://github.com/storpipfugl/pykdtree/pull/124) - Enable Python 3.13 wheel building and switch to C17 C standard
+
+In this release 2 pull requests were closed.
+
+
+
 ## Version 1.3.12 (2024/04/12)
 
 ### Pull Requests Merged


=====================================
pykdtree/kdtree.pyx
=====================================
@@ -94,6 +94,10 @@ cdef class KDTree:
         # Check arguments
         if leafsize < 1:
             raise ValueError('leafsize must be greater than zero')
+        if data_pts.ndim != 2:
+            raise ValueError('data_pts array should have exactly 2 dimensions')
+        if data_pts.size == 0:
+            raise ValueError('data_pts should be non-empty')
 
         # Get data content
         cdef np.ndarray[float, ndim=1] data_array_float


=====================================
pykdtree/test_tree.py
=====================================
@@ -2,7 +2,6 @@ import numpy as np
 
 from pykdtree.kdtree import KDTree
 
-
 data_pts_real = np.array([[  790535.062,  -369324.656,  6310963.5  ],
        [  790024.312,  -365155.688,  6311270.   ],
        [  789515.75 ,  -361009.469,  6311572.   ],
@@ -106,9 +105,9 @@ data_pts_real = np.array([[  790535.062,  -369324.656,  6310963.5  ],
 
 def test1d():
 
-    data_pts = np.arange(1000)
+    data_pts = np.arange(1000)[..., None]
     kdtree = KDTree(data_pts, leafsize=15)
-    query_pts = np.arange(400, 300, -10)
+    query_pts = np.arange(400, 300, -10)[..., None]
     dist, idx = kdtree.query(query_pts)
     assert idx[0] == 400
     assert dist[0] == 0
@@ -301,16 +300,17 @@ def test_scipy_comp():
 
 
 def test1d_mask():
-    data_pts = np.arange(1000)
+    data_pts = np.arange(1000)[..., None]
     # put the input locations in random order
     np.random.shuffle(data_pts)
-    bad_idx = np.nonzero(data_pts == 400)
-    nearest_idx_1 = np.nonzero(data_pts == 399)
-    nearest_idx_2 = np.nonzero(data_pts == 390)
+    bad_idx = np.nonzero(data_pts[..., 0] == 400)
+    print(bad_idx)
+    nearest_idx_1 = np.nonzero(data_pts[..., 0] == 399)
+    nearest_idx_2 = np.nonzero(data_pts[..., 0] == 390)
     kdtree = KDTree(data_pts, leafsize=15)
     # shift the query points just a little bit for known neighbors
     # we want 399 as a result, not 401, when we query for ~400
-    query_pts = np.arange(399.9, 299.9, -10)
+    query_pts = np.arange(399.9, 299.9, -10)[..., None]
     query_mask = np.zeros(data_pts.shape[0]).astype(bool)
     query_mask[bad_idx] = True
     dist, idx = kdtree.query(query_pts, mask=query_mask)
@@ -321,10 +321,10 @@ def test1d_mask():
 
 
 def test1d_all_masked():
-    data_pts = np.arange(1000)
+    data_pts = np.arange(1000)[..., None]
     np.random.shuffle(data_pts)
     kdtree = KDTree(data_pts, leafsize=15)
-    query_pts = np.arange(400, 300, -10)
+    query_pts = np.arange(400, 300, -10)[..., None]
     query_mask = np.ones(data_pts.shape[0]).astype(bool)
     dist, idx = kdtree.query(query_pts, mask=query_mask)
     # all invalid
@@ -370,3 +370,16 @@ def test127d_ok():
     kdtree = KDTree(data_pts)
     dist, idx = kdtree.query(data_pts)
     assert np.all(dist == 0)
+
+
+def test_empty_fail():
+    data_pts = np.array([1, 2, 3])
+    try:
+        kdtree = KDTree(data_pts)
+    except ValueError as e:
+        assert 'exactly 2 dimensions' in str(e), str(e)
+    data_pts = np.array([[]])
+    try:
+        kdtree = KDTree(data_pts)
+    except ValueError as e:
+        assert 'non-empty' in str(e), str(e)


=====================================
setup.py
=====================================
@@ -57,7 +57,7 @@ class build_ext_subclass(build_ext):
         comp = self.compiler.compiler_type
         omp_comp, omp_link = _omp_compile_link_args(comp)
         if comp in ('unix', 'cygwin', 'mingw32'):
-            extra_compile_args = ['-std=c99', '-O3'] + omp_comp
+            extra_compile_args = ['-std=c17', '-O3'] + omp_comp
             extra_link_args = omp_link
         elif comp == 'msvc':
             extra_compile_args = ['/Ox'] + omp_comp
@@ -197,7 +197,7 @@ extensions = [
 
 setup(
     name='pykdtree',
-    version='1.3.12',
+    version='1.3.13',
     url="https://github.com/storpipfugl/pykdtree",
     description='Fast kd-tree implementation with OpenMP-enabled queries',
     long_description=readme,



View it on GitLab: https://salsa.debian.org/debian-gis-team/pykdtree/-/commit/a30ed48eacbef2a7e06f95c52232c95b0f0b28e9

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pykdtree/-/commit/a30ed48eacbef2a7e06f95c52232c95b0f0b28e9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240907/ce5354d6/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list