[Git][debian-gis-team/python-rtree][master] 4 commits: New upstream version 1.3.0

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Wed Jul 10 06:15:18 BST 2024



Bas Couwenberg pushed to branch master at Debian GIS Project / python-rtree


Commits:
c00c2816 by Bas Couwenberg at 2024-07-10T05:39:42+02:00
New upstream version 1.3.0
- - - - -
7587c981 by Bas Couwenberg at 2024-07-10T05:39:43+02:00
Update upstream source from tag 'upstream/1.3.0'

Update to upstream version '1.3.0'
with Debian dir c3839da51efa9b5a60e48d8be2f0a11ff941901c
- - - - -
31bda1a3 by Bas Couwenberg at 2024-07-10T05:39:54+02:00
New upstream release.

- - - - -
ae02361b by Bas Couwenberg at 2024-07-10T05:41:49+02:00
Drop index-version.patch, included upstream.

- - - - -


22 changed files:

- .github/workflows/deploy.yml
- .github/workflows/test.yml
- .pre-commit-config.yaml
- CHANGES.rst
- CREDITS.txt
- − ci/CMakeLists.txt
- ci/install_libspatialindex.bash
- ci/install_libspatialindex.bat
- debian/changelog
- − debian/patches/index-version.patch
- − debian/patches/series
- docs/source/performance.rst
- pyproject.toml
- rtree/__init__.py
- rtree/exceptions.py
- rtree/finder.py
- rtree/index.py
- scripts/repair_wheel.py
- setup.py
- tests/test_index.py
- tests/test_tpr.py
- tox.ini


Changes:

=====================================
.github/workflows/deploy.yml
=====================================
@@ -34,6 +34,9 @@ jobs:
       with:
         python-version: '3.11'
 
+    - name: Setup
+      run: pip install wheel
+
     - uses: ilammy/msvc-dev-cmd at v1
       if: startsWith(matrix.os, 'windows')
 
@@ -44,7 +47,7 @@ jobs:
         ci\install_libspatialindex.bat
 
     - name: Build wheels
-      uses: pypa/cibuildwheel at v2.16.2
+      uses: pypa/cibuildwheel at v2.19.2
 
     - uses: actions/upload-artifact at v4
       with:


=====================================
.github/workflows/test.yml
=====================================
@@ -17,7 +17,7 @@ jobs:
     steps:
     - uses: actions/checkout at v4
     - uses: actions/setup-python at v5
-    - uses: pre-commit/action at v3.0.0
+    - uses: pre-commit/action at v3.0.1
 
   conda:
     name: Conda ${{ matrix.python-version }} - ${{ matrix.os }}
@@ -30,7 +30,11 @@ jobs:
       matrix:
         os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
         python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
-        sidx-version: ['1.8.5','1.9.3']
+        # test oldesst and newest libspatialindex versions
+        sidx-version: ['1.8.5', '2.0.0']
+        exclude:
+          - os: 'macos-latest'
+          - sidx-version: '1.8.5'
 
     steps:
     - uses: actions/checkout at v4


=====================================
.pre-commit-config.yaml
=====================================
@@ -1,25 +1,27 @@
+ci:
+  autoupdate_schedule: quarterly
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.4.0
+    rev: v4.6.0
     hooks:
-    -   id: check-yaml
-    -   id: end-of-file-fixer
-    -   id: trailing-whitespace
+    - id: check-yaml
+    - id: end-of-file-fixer
+    - id: trailing-whitespace
   - repo: https://github.com/python-jsonschema/check-jsonschema
     rev: 0.27.3
     hooks:
-    -   id: check-github-workflows
-        args: ["--verbose"]
-  - repo: https://github.com/psf/black
-    rev: 23.9.1
-    hooks:
-    -   id: black
+    - id: check-github-workflows
+      args: ["--verbose"]
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: v0.0.291
+    rev: v0.5.0
     hooks:
-    -   id: ruff
+    # Run the linter.
+    - id: ruff
+      args: [ --fix ]
+    # Run the formatter.
+    - id: ruff-format
   - repo: https://github.com/pre-commit/mirrors-mypy
     rev: v1.5.1
     hooks:
-    -   id: mypy
-        exclude: 'docs/.'
+    - id: mypy
+      exclude: 'docs/.'


=====================================
CHANGES.rst
=====================================
@@ -1,3 +1,11 @@
+1.3.0: 2024-07-10
+=================
+
+- Upgrade binary wheels with libspatialindex-2.0.0 (:PR:`316`)
+- Fix binary wheels for musllinux wheels (:PR:`316`)
+- Update code style, replace isort and black with ruff, modern numpy rng (:PR:`319`)
+- Remove libsidx version testing (:PR:`313`)
+
 1.2.0: 2024-01-19
 =================
 


=====================================
CREDITS.txt
=====================================
@@ -34,4 +34,4 @@ Adam Stewart
 Mike Taves <mwtoews at gmail.com>
 
 * cibuildwheel configuration
-* general maintanance
+* general maintenance


=====================================
ci/CMakeLists.txt deleted
=====================================
@@ -1,237 +0,0 @@
-#
-# top-level CMake configuration file for libspatialindex
-#
-# (based originally on the libLAS files copyright Mateusz Loskot)
-
-SET(MSVC_INCREMENTAL_DEFAULT OFF)
-cmake_minimum_required(VERSION 3.5.0)
-project(spatialindex)
-
-#------------------------------------------------------------------------------
-# internal cmake settings
-#------------------------------------------------------------------------------
-
-set(CMAKE_COLOR_MAKEFILE ON)
-
-# C++11 required
-set (CMAKE_CXX_STANDARD 11)
-
-# Allow advanced users to generate Makefiles printing detailed commands
-mark_as_advanced(CMAKE_VERBOSE_MAKEFILE)
-
-# Path to additional CMake modules
-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
-
-# Make string comparison in cmake behave like you'd expect
-cmake_policy(SET CMP0054 NEW)
-
-if (WIN32)
-    if(${CMAKE_VERSION} VERSION_GREATER "3.14.5")
-      cmake_policy(SET CMP0092 NEW) # don't put /w3 in flags
-    endif()
-endif()
-
-if (APPLE)
-	set(CMAKE_MACOSX_RPATH ON)
-endif (APPLE)
-
-#------------------------------------------------------------------------------
-# libspatialindex general settings
-#------------------------------------------------------------------------------
-
-SET(SIDX_VERSION_MAJOR "1")
-SET(SIDX_VERSION_MINOR "9")
-SET(SIDX_VERSION_PATCH "3")
-SET(SIDX_LIB_VERSION "6.1.1")
-SET(SIDX_LIB_SOVERSION "6")
-SET(BUILD_SHARED_LIBS ON)
-
-
-set(SIDX_VERSION_STRING "${SIDX_VERSION_MAJOR}.${SIDX_VERSION_MINOR}.${SIDX_VERSION_PATCH}")
-
-#------------------------------------------------------------------------------
-# libspatialindex general cmake options
-#------------------------------------------------------------------------------
-
-option(SIDX_BUILD_TESTS "Enables integrated test suites" OFF)
-
-
-# Name of C++ library
-
-set(SIDX_LIB_NAME spatialindex)
-set(SIDX_C_LIB_NAME spatialindex_c)
-
-if(WIN32)
-  if (MSVC)
-	if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-		set( SIDX_LIB_NAME "spatialindex-64" )
-		set( SIDX_C_LIB_NAME "spatialindex_c-64" )
-	else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-		set( SIDX_LIB_NAME "spatialindex-32"  )
-		set( SIDX_C_LIB_NAME "spatialindex_c-32"  )
-	endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-      endif()
-endif()
-
-set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
-
-include (CheckFunctionExists)
-
-check_function_exists(srand48 HAVE_SRAND48)
-check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
-check_function_exists(memset HAVE_MEMSET)
-check_function_exists(memcpy HAVE_MEMCPY)
-check_function_exists(bcopy HAVE_BCOPY)
-
-
-INCLUDE (CheckIncludeFiles)
-
-
-#------------------------------------------------------------------------------
-# General build settings
-#------------------------------------------------------------------------------
-
-# note we default to RelWithDebInfo mode if not set
-if(NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
-    "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" FORCE)
-endif()
-
-# Always show which build type we have
-message(STATUS "Setting libspatialindex build type - ${CMAKE_BUILD_TYPE}")
-
-set(SIDX_BUILD_TYPE ${CMAKE_BUILD_TYPE})
-
-# TODO: Still testing the output paths --mloskot
-set(SIDX_BUILD_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
-
-# Output directory in which to build RUNTIME target files.
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SIDX_BUILD_OUTPUT_DIRECTORY})
-
-# Output directory in which to build LIBRARY target files
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SIDX_BUILD_OUTPUT_DIRECTORY})
-
-# Output directory in which to build ARCHIVE target files.
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SIDX_BUILD_OUTPUT_DIRECTORY})
-
-
-#------------------------------------------------------------------------------
-# Platform and compiler specific settings
-#------------------------------------------------------------------------------
-
-if(NOT WIN32)
-  # Recommended C++ compilation flags
-  set(SIDX_COMMON_CXX_FLAGS
-    "-pedantic -Wall -Wpointer-arith -Wcast-align -Wcast-qual  -Wredundant-decls -Wno-long-long -Wl --no-undefined")
-endif(NOT WIN32)
-
-if (APPLE)
-  set(SO_EXT dylib)
-  set(CMAKE_FIND_FRAMEWORK "LAST")
-elseif(WIN32)
-  set(SO_EXT dll)
-else()
-  set(SO_EXT so)
-endif(APPLE)
-
-
-enable_testing()
-
-#------------------------------------------------------------------------------
-# installation path settings
-#------------------------------------------------------------------------------
-
-if(WIN32)
-  set(DEFAULT_LIB_SUBDIR lib)
-  set(DEFAULT_DATA_SUBDIR .)
-  set(DEFAULT_INCLUDE_SUBDIR include)
-
-  if (MSVC)
-    set(DEFAULT_BIN_SUBDIR bin)
-  else()
-    set(DEFAULT_BIN_SUBDIR .)
-  endif()
-else()
-  # Common locations for Unix and Mac OS X
-  set(DEFAULT_BIN_SUBDIR bin)
-  set(DEFAULT_LIB_SUBDIR lib${LIB_SUFFIX})
-  set(DEFAULT_DATA_SUBDIR share/spatialindex)
-  set(DEFAULT_INCLUDE_SUBDIR include)
-endif()
-
-# Locations are changeable by user to customize layout of SIDX installation
-# (default values are platform-specific)
-set(SIDX_BIN_SUBDIR ${DEFAULT_BIN_SUBDIR} CACHE STRING
-  "Subdirectory where executables will be installed")
-set(SIDX_LIB_SUBDIR ${DEFAULT_LIB_SUBDIR} CACHE STRING
-  "Subdirectory where libraries will be installed")
-set(SIDX_INCLUDE_SUBDIR ${DEFAULT_INCLUDE_SUBDIR} CACHE STRING
-  "Subdirectory where header files will be installed")
-set(SIDX_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING
-  "Subdirectory where data will be installed")
-
-# Mark *_SUBDIR variables as advanced and dedicated to use by power-users only.
-mark_as_advanced(SIDX_BIN_SUBDIR
-  SIDX_LIB_SUBDIR SIDX_INCLUDE_SUBDIR SIDX_DATA_SUBDIR)
-
-# Full paths for the installation
-set(SIDX_BIN_DIR ${SIDX_BIN_SUBDIR})
-set(SIDX_LIB_DIR ${SIDX_LIB_SUBDIR})
-set(SIDX_INCLUDE_DIR ${SIDX_INCLUDE_SUBDIR})
-set(SIDX_DATA_DIR ${SIDX_DATA_SUBDIR})
-
-#------------------------------------------------------------------------------
-# subdirectory controls
-#------------------------------------------------------------------------------
-
-add_subdirectory(src)
-
-if(SIDX_BUILD_TESTS)
-  add_subdirectory(test)
-endif()
-
-#------------------------------------------------------------------------------
-# CPACK controls
-#------------------------------------------------------------------------------
-
-SET(CPACK_PACKAGE_VERSION_MAJOR ${SIDX_VERSION_MAJOR})
-SET(CPACK_PACKAGE_VERSION_MINOR ${SIDX_VERSION_MINOR})
-SET(CPACK_PACKAGE_VERSION_PATCH ${SIDX_VERSION_MINOR})
-SET(CPACK_PACKAGE_NAME "libspatialindex")
-
-SET(CPACK_SOURCE_GENERATOR "TBZ2;TGZ")
-SET(CPACK_PACKAGE_VENDOR "libspatialindex Development Team")
-SET(CPACK_RESOURCE_FILE_LICENSE    "${PROJECT_SOURCE_DIR}/COPYING")
-
-set(CPACK_SOURCE_PACKAGE_FILE_NAME
-    "${CMAKE_PROJECT_NAME}-src-${SIDX_VERSION_STRING}")
-
-set(CPACK_SOURCE_IGNORE_FILES
-"/\\\\.gitattributes;/\\\\.vagrant;/\\\\.DS_Store;/CVS/;/\\\\.git/;\\\\.swp$;~$;\\\\.\\\\#;/\\\\#")
-
-list(APPEND CPACK_SOURCE_IGNORE_FILES "CMakeScripts/")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "_CPack_Packages")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "cmake_install.cmake")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "/bin/")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "/scripts/")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "/azure-pipelines.yml")
-list(APPEND CPACK_SOURCE_IGNORE_FILES ".gitignore")
-list(APPEND CPACK_SOURCE_IGNORE_FILES ".ninja*")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "HOWTORELEASE.txt")
-
-list(APPEND CPACK_SOURCE_IGNORE_FILES "README")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "build/")
-
-list(APPEND CPACK_SOURCE_IGNORE_FILES "CMakeFiles")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "CTestTestfile.cmake")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "/docs/build/")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "/doc/presentations/")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "package-release.sh")
-list(APPEND CPACK_SOURCE_IGNORE_FILES "docker-package.sh")
-
-list(APPEND CPACK_SOURCE_IGNORE_FILES ".gz2")
-
-list(APPEND CPACK_SOURCE_IGNORE_FILES ".bz2")
-
-include(CPack)
-add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)


=====================================
ci/install_libspatialindex.bash
=====================================
@@ -2,26 +2,15 @@
 set -xe
 
 # A simple script to install libspatialindex from a Github Release
-VERSION=1.9.3
-SHA256=63a03bfb26aa65cf0159f925f6c3491b6ef79bc0e3db5a631d96772d6541187e
+VERSION=2.0.0
+SHA256=8caa4564c4592824acbf63a2b883aa2d07e75ccd7e9bf64321c455388a560579
 
 # where to copy resulting files
 # this has to be run before `cd`-ing anywhere
-libtarget() {
+install_prefix() {
   OURPWD=$PWD
   cd "$(dirname "$0")"
-  mkdir -p ../rtree/lib
-  cd ../rtree/lib
-  arr=$(pwd)
-  cd "$OURPWD"
-  echo $arr
-}
-
-headertarget() {
-  OURPWD=$PWD
-  cd "$(dirname "$0")"
-  mkdir -p ../rtree/include
-  cd ../rtree/include
+  cd ../rtree
   arr=$(pwd)
   cd "$OURPWD"
   echo $arr
@@ -36,48 +25,44 @@ scriptloc() {
 }
 # note that we're doing this convoluted thing to get
 # an absolute path so mac doesn't yell at us
-LIBTARGET=`libtarget`
-HEADERTARGET=`headertarget`
+INSTALL_PREFIX=`install_prefix`
 SL=`scriptloc`
 
-rm $VERSION.zip || true
-curl -L -O https://github.com/libspatialindex/libspatialindex/archive/$VERSION.zip
+rm -f $VERSION.zip
+curl -LOs --retry 5 --retry-max-time 120 https://github.com/libspatialindex/libspatialindex/archive/${VERSION}.zip
 
 # check the file hash
 echo "${SHA256}  ${VERSION}.zip" | sha256sum -c -
 
-rm -rf "libspatialindex-${VERSION}" || true
+rm -rf "libspatialindex-${VERSION}"
 unzip -q $VERSION
 cd libspatialindex-${VERSION}
 
 mkdir build
 cd build
 
-cp "${SL}/CMakeLists.txt" ..
-
 printenv
 
 if [ "$(uname)" == "Darwin" ]; then
-    CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=${ARCHFLAGS##* }"
+    CMAKE_ARGS="-D CMAKE_OSX_ARCHITECTURES=${ARCHFLAGS##* } \
+                -D CMAKE_INSTALL_RPATH=@loader_path"
 fi
 
-cmake -DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS} ..
+cmake ${CMAKE_ARGS} \
+  -D CMAKE_BUILD_TYPE=Release \
+  -D BUILD_SHARED_LIBS=ON \
+  -D CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
+  -D CMAKE_INSTALL_LIBDIR=lib \
+  -D CMAKE_PLATFORM_NO_VERSIONED_SONAME=ON \
+  ..
 make -j 4
 
 # copy built libraries relative to path of this script
-# -d means copy links as links rather than duplicate files
-# macos uses "bsd cp" and needs special handling
-if [ "$(uname)" == "Darwin" ]; then
-    # change the rpath in the dylib to point to the same directory
-    install_name_tool -change @rpath/libspatialindex.6.dylib @loader_path/libspatialindex.dylib bin/libspatialindex_c.dylib
-    # copy the dylib files to the target director
-    cp bin/libspatialindex.dylib $LIBTARGET
-    cp bin/libspatialindex_c.dylib $LIBTARGET
-    cp -r ../include/* $HEADERTARGET
-else
-    cp -L bin/* $LIBTARGET
-    cp -r ../include/* $HEADERTARGET
-fi
+make install
+
+# remove unneeded extras in lib
+rm -rfv ${INSTALL_PREFIX}/lib/cmake
+rm -rfv ${INSTALL_PREFIX}/lib/pkgconfig
 
-ls $LIBTARGET
-ls -R $HEADERTARGET
+ls -R ${INSTALL_PREFIX}/lib
+ls -R ${INSTALL_PREFIX}/include


=====================================
ci/install_libspatialindex.bat
=====================================
@@ -1,13 +1,11 @@
 python -c "import sys; print(sys.version)"
 
-set SIDX_VERSION=1.9.3
+set SIDX_VERSION=2.0.0
 
-curl -OL "https://github.com/libspatialindex/libspatialindex/archive/%SIDX_VERSION%.zip"
+curl -LO --retry 5 --retry-max-time 120 "https://github.com/libspatialindex/libspatialindex/archive/%SIDX_VERSION%.zip"
 
 tar xvf "%SIDX_VERSION%.zip"
 
-REM unzip 1.9.3.zip
-REM copy %~dp0\CMakeLists.txt libspatialindex-1.9.3\CMakeLists.txt
 cd libspatialindex-%SIDX_VERSION%
 
 mkdir build
@@ -15,15 +13,21 @@ cd build
 
 pip install ninja
 
-cmake -D CMAKE_BUILD_TYPE=Release -G Ninja ..
+set INSTALL_PREFIX=%~dp0\..\rtree
 
-ninja
+cmake -G Ninja ^
+      -D CMAKE_BUILD_TYPE=Release ^
+      -D BUILD_SHARED_LIBS="ON" ^
+      -D CMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" ^
+      -D CMAKE_INSTALL_BINDIR=lib ^
+      -D CMAKE_INSTALL_LIBDIR=libdir ^
+      ..
 
-mkdir %~dp0\..\rtree\lib
-copy bin\*.dll %~dp0\..\rtree\lib
-xcopy /S ..\include\* %~dp0\..\rtree\include\
-rmdir /Q /S bin
+ninja install
 
-dir %~dp0\..\rtree\
-dir %~dp0\..\rtree\lib
-dir %~dp0\..\rtree\include
+:: remove unneeded libdir
+rmdir %INSTALL_PREFIX%\libdir /s /q
+
+dir %INSTALL_PREFIX%
+dir %INSTALL_PREFIX%\lib
+dir %INSTALL_PREFIX%\include /s


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+python-rtree (1.3.0-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+  * Drop index-version.patch, included upstream.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Wed, 10 Jul 2024 05:39:49 +0200
+
 python-rtree (1.2.0-2) unstable; urgency=medium
 
   * Use pybuild to get build_dir path.


=====================================
debian/patches/index-version.patch deleted
=====================================
@@ -1,20 +0,0 @@
-Description: drop version testing. not valuable (#313)
-Author: Howard Butler <hobu.inc at gmail.com>
-Origin: https://github.com/Toblerity/rtree/commit/9a08ab91a8253b8f006d176ed698c948987e471e
-Bug: https://github.com/Toblerity/rtree/issues/312
-
---- a/tests/test_index.py
-+++ b/tests/test_index.py
-@@ -42,12 +42,6 @@ class IndexTestCase(unittest.TestCase):
-         assert next(rtree_test.intersection([1, 1, 1, 2, 2, 2])) == 1564
- 
- 
--class IndexVersion(unittest.TestCase):
--    def test_libsidx_version(self) -> None:
--        self.assertTrue(index.major_version == 1)
--        self.assertTrue(index.minor_version >= 7)
--
--
- class IndexCount(unittest.TestCase):
-     def setUp(self) -> None:
-         self.boxes15 = np.genfromtxt("boxes_15x15.data")


=====================================
debian/patches/series deleted
=====================================
@@ -1 +0,0 @@
-index-version.patch


=====================================
docs/source/performance.rst
=====================================
@@ -40,7 +40,7 @@ Override :py:data:`~rtree.index.Index.dumps` to use the highest pickle protocol
 
 .. topic:: Update from January 2024
 
-   Pickling is currently broken and awaiting a pull requst to fix it.
+   Pickling is currently broken and awaiting a pull request to fix it.
    For more information, see the `pull request on GitHub`_.
 
 .. _pull request on GitHub: https://github.com/Toblerity/rtree/pull/197


=====================================
pyproject.toml
=====================================
@@ -48,21 +48,19 @@ version = {attr = "rtree.__version__"}
 [tool.setuptools.package-data]
 rtree = ["py.typed"]
 
-[tool.black]
-target-version = ["py38", "py39", "py310", "py311", "py312"]
-color = true
-skip_magic_trailing_comma = true
-
 [tool.cibuildwheel]
 build = "cp38-*"
-build-verbosity = "3"
+build-verbosity = 3
 repair-wheel-command = "python scripts/repair_wheel.py -w {dest_dir} {wheel}"
 test-requires = "tox"
 test-command = "tox --conf {project} --installpkg {wheel}"
+test-skip = [
+    "*aarch64",  # slow!
+    "*-macosx_arm64",
+]
 
 [tool.cibuildwheel.linux]
 archs = ["auto", "aarch64"]
-test-skip = "*aarch64"  # slow!
 before-build = [
     "yum install -y cmake libffi-devel",
     "bash {project}/ci/install_libspatialindex.bash",
@@ -77,7 +75,6 @@ before-build = [
 
 [tool.cibuildwheel.macos]
 archs = ["x86_64", "arm64"]
-test-skip = "*-macosx_arm64"
 environment = { MACOSX_DEPLOYMENT_TARGET="10.9" }
 before-build = [
     "brew install coreutils cmake",
@@ -95,11 +92,14 @@ exclude_lines = [
     "@overload",
 ]
 
-[tool.isort]
-profile = "black"
-known_first_party = ["rtree"]
-skip_gitignore = true
-color_output = true
+[tool.ruff.lint]
+select = [
+    "E", "W",  # pycodestyle
+    "F",   # Pyflakes
+    "UP",  # pyupgrade
+    "I",   # isort
+    "NPY",  # NumPy-specific
+]
 
 [tool.mypy]
 exclude = ["docs", "build"]


=====================================
rtree/__init__.py
=====================================
@@ -4,8 +4,9 @@
 Rtree provides Python bindings to libspatialindex for quick
 hyperrectangular intersection queries.
 """
+
 from __future__ import annotations
 
-__version__ = "1.2.0"
+__version__ = "1.3.0"
 
 from .index import Index, Rtree  # noqa


=====================================
rtree/exceptions.py
=====================================
@@ -3,4 +3,5 @@ from __future__ import annotations
 
 class RTreeError(Exception):
     "RTree exception, indicates a RTree-related error."
+
     pass


=====================================
rtree/finder.py
=====================================
@@ -1,6 +1,7 @@
 """
 Locate `libspatialindex` shared library and header files.
 """
+
 from __future__ import annotations
 
 import ctypes


=====================================
rtree/index.py
=====================================
@@ -246,7 +246,7 @@ class Index:
 
             d = os.path.dirname(p)
             if not os.access(d, os.W_OK):
-                message = "Unable to open file '%s' for index storage" % f
+                message = f"Unable to open file '{f}' for index storage"
                 raise OSError(message)
         elif storage:
             self.properties.storage = RT_Custom
@@ -296,9 +296,7 @@ class Index:
             return 0
 
     def __repr__(self) -> str:
-        return "rtree.index.Index(bounds={}, size={})".format(
-            self.bounds, self.get_size()
-        )
+        return f"rtree.index.Index(bounds={self.bounds}, size={self.get_size()})"
 
     def __getstate__(self) -> dict[str, Any]:
         state = self.__dict__.copy()
@@ -575,18 +573,17 @@ class Index:
         return p_num_results.value
 
     @overload
-    def contains(self, coordinates: Any, objects: Literal[True]) -> Iterator[Item]:
-        ...
+    def contains(self, coordinates: Any, objects: Literal[True]) -> Iterator[Item]: ...
 
     @overload
     def contains(
         self, coordinates: Any, objects: Literal[False] = False
-    ) -> Iterator[int] | None:
-        ...
+    ) -> Iterator[int] | None: ...
 
     @overload
-    def contains(self, coordinates: Any, objects: Literal["raw"]) -> Iterator[object]:
-        ...
+    def contains(
+        self, coordinates: Any, objects: Literal["raw"]
+    ) -> Iterator[object]: ...
 
     def contains(
         self, coordinates: Any, objects: bool | Literal["raw"] = False
@@ -724,20 +721,19 @@ class Index:
         return new_idx
 
     @overload
-    def intersection(self, coordinates: Any, objects: Literal[True]) -> Iterator[Item]:
-        ...
+    def intersection(
+        self, coordinates: Any, objects: Literal[True]
+    ) -> Iterator[Item]: ...
 
     @overload
     def intersection(
         self, coordinates: Any, objects: Literal[False] = False
-    ) -> Iterator[int]:
-        ...
+    ) -> Iterator[int]: ...
 
     @overload
     def intersection(
         self, coordinates: Any, objects: Literal["raw"]
-    ) -> Iterator[object]:
-        ...
+    ) -> Iterator[object]: ...
 
     def intersection(
         self, coordinates: Any, objects: bool | Literal["raw"] = False
@@ -952,20 +948,17 @@ class Index:
     @overload
     def nearest(
         self, coordinates: Any, num_results: int, objects: Literal[True]
-    ) -> Iterator[Item]:
-        ...
+    ) -> Iterator[Item]: ...
 
     @overload
     def nearest(
         self, coordinates: Any, num_results: int, objects: Literal[False] = False
-    ) -> Iterator[int]:
-        ...
+    ) -> Iterator[int]: ...
 
     @overload
     def nearest(
         self, coordinates: Any, num_results: int, objects: Literal["raw"]
-    ) -> Iterator[object]:
-        ...
+    ) -> Iterator[object]: ...
 
     def nearest(
         self,
@@ -2104,7 +2097,7 @@ class RtreeContainer(Rtree):
                 or isinstance(args[0], bytes)
                 or isinstance(args[0], ICustomStorage)
             ):
-                raise ValueError("%s supports only in-memory indexes" % self.__class__)
+                raise ValueError(f"{self.__class__} supports only in-memory indexes")
         self._objects: dict[int, tuple[int, object]] = {}
         return super().__init__(*args, **kwargs)
 
@@ -2171,14 +2164,12 @@ class RtreeContainer(Rtree):
     add = insert  # type: ignore[assignment]
 
     @overload  # type: ignore[override]
-    def intersection(self, coordinates: Any, bbox: Literal[True]) -> Iterator[Item]:
-        ...
+    def intersection(self, coordinates: Any, bbox: Literal[True]) -> Iterator[Item]: ...
 
     @overload
     def intersection(
         self, coordinates: Any, bbox: Literal[False] = False
-    ) -> Iterator[object]:
-        ...
+    ) -> Iterator[object]: ...
 
     def intersection(
         self, coordinates: Any, bbox: bool = False
@@ -2252,14 +2243,12 @@ class RtreeContainer(Rtree):
     @overload  # type: ignore[override]
     def nearest(
         self, coordinates: Any, num_results: int = 1, bbox: Literal[True] = True
-    ) -> Iterator[Item]:
-        ...
+    ) -> Iterator[Item]: ...
 
     @overload
     def nearest(
         self, coordinates: Any, num_results: int = 1, bbox: Literal[False] = False
-    ) -> Iterator[object]:
-        ...
+    ) -> Iterator[object]: ...
 
     def nearest(
         self, coordinates: Any, num_results: int = 1, bbox: bool = False
@@ -2367,5 +2356,5 @@ class RtreeContainer(Rtree):
                 [self._objects[child_id][1] for child_id in child_ids],
                 bounds,
             )
-            for id, child_ids, bounds in super(RtreeContainer, self).leaves()
+            for id, child_ids, bounds in super().leaves()
         ]


=====================================
scripts/repair_wheel.py
=====================================
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import argparse
+import os
 import shutil
 import subprocess
 import sys
@@ -17,7 +18,7 @@ def main():
         os_ = "windows"
     else:
         raise NotImplementedError(
-            "sys.platform '{}' is not supported yet.".format(sys.platform)
+            f"sys.platform '{sys.platform}' is not supported yet."
         )
 
     p = argparse.ArgumentParser(
@@ -43,6 +44,13 @@ def main():
         tmpdir = Path(tmpdir_)
         # use the platform specific repair tool first
         if os_ == "linux":
+            # use path from cibuildwheel which allows auditwheel to create
+            # Rtree.libs/libspatialindex-*.so.*
+            cibw_lib_path = "/project/rtree/lib"
+            if os.environ.get("LD_LIBRARY_PATH"):  # append path
+                os.environ["LD_LIBRARY_PATH"] += f"{os.pathsep}{cibw_lib_path}"
+            else:
+                os.environ["LD_LIBRARY_PATH"] = cibw_lib_path
             subprocess.run(
                 ["auditwheel", "repair", "-w", str(tmpdir), str(file)], check=True
             )
@@ -85,9 +93,15 @@ def main():
                 break
         else:
             raise RuntimeError("subdirectory not found")
+
         if os_ == "linux":
+            # This is auditwheel's libs, which needs post-processing
+            libs_dir = unpackdir / "Rtree.libs"
+            lsidx_list = list(libs_dir.glob("libspatialindex*.so*"))
+            assert len(lsidx_list) == 1, list(libs_dir.iterdir())
+            lsidx = lsidx_list[0]
+            subprocess.run(["patchelf", "--set-rpath", "$ORIGIN", lsidx], check=True)
             # remove duplicated dir
-            assert len(list((unpackdir / "Rtree.libs").glob("*.so*"))) >= 1
             lib_dir = unpackdir / "rtree" / "lib"
             shutil.rmtree(lib_dir)
         # re-pack


=====================================
setup.py
=====================================
@@ -1,5 +1,4 @@
 #!/usr/bin/env python3
-import sys
 from pathlib import Path
 
 from setuptools import setup
@@ -43,38 +42,17 @@ class InstallPlatlib(install):  # type: ignore[misc]
         # destination for the files in the build directory
         target_dir = Path(self.build_lib) / "rtree"
 
+        # copy lib tree
         source_lib = source_dir / "lib"
-        target_lib = target_dir / "lib"
         if source_lib.is_dir():
-            # what patterns represent shared libraries for supported platforms
-            if sys.platform.startswith("win"):
-                lib_pattern = "*.dll"
-            elif sys.platform.startswith("linux"):
-                lib_pattern = "*.so*"
-            elif sys.platform == "darwin":
-                lib_pattern = "libspatialindex*dylib"
-            else:
-                raise ValueError(f"unhandled platform {sys.platform!r}")
-
-            target_lib.mkdir(parents=True, exist_ok=True)
-            for pth in source_lib.glob(lib_pattern):
-                # if the source isn't a file skip it
-                if not pth.is_file():
-                    continue
-
-                # copy the source file to the target directory
-                self.copy_file(str(pth), str(target_lib / pth.name))
+            target_lib = target_dir / "lib"
+            self.copy_tree(str(source_lib), str(target_lib))
 
+        # copy include tree
         source_include = source_dir / "include"
-        target_include = target_dir / "include"
         if source_include.is_dir():
-            for pth in source_include.rglob("*.h"):
-                rpth = pth.relative_to(source_include)
-
-                # copy the source file to the target directory
-                target_subdir = target_include / rpth.parent
-                target_subdir.mkdir(parents=True, exist_ok=True)
-                self.copy_file(str(pth), str(target_subdir))
+            target_include = target_dir / "include"
+            self.copy_tree(str(source_include), str(target_include))
 
 
 # See pyproject.toml for other project metadata


=====================================
tests/test_index.py
=====================================
@@ -42,12 +42,6 @@ class IndexTestCase(unittest.TestCase):
         assert next(rtree_test.intersection([1, 1, 1, 2, 2, 2])) == 1564
 
 
-class IndexVersion(unittest.TestCase):
-    def test_libsidx_version(self) -> None:
-        self.assertTrue(index.major_version == 1)
-        self.assertTrue(index.minor_version >= 7)
-
-
 class IndexCount(unittest.TestCase):
     def setUp(self) -> None:
         self.boxes15 = np.genfromtxt("boxes_15x15.data")
@@ -262,7 +256,7 @@ class IndexIntersection(IndexTestCase):
         hit = [h for h in hits if h.id == 4321][0]
         self.assertEqual(hit.id, 4321)
         self.assertEqual(hit.object, 42)
-        box = ["%.10f" % t for t in hit.bbox]
+        box = [f"{t:.10f}" for t in hit.bbox]
         expected = ["34.3776829412", "26.7375853734", "49.3776829412", "41.7375853734"]
         self.assertEqual(box, expected)
 


=====================================
tests/test_tpr.py
=====================================
@@ -7,6 +7,7 @@ from math import ceil
 from typing import Any, Iterator
 
 import numpy as np
+from numpy.random import default_rng
 
 from rtree.index import Index, Property, RT_TPRTree
 
@@ -79,16 +80,18 @@ def data_generator(
     max_x: int = 1,
     max_y: int = 1,
 ) -> Iterator[tuple[str, int, Any]]:
+    rng = default_rng()
+
     def create_object(
         id_: float, time: float, x: float | None = None, y: float | None = None
     ) -> Cartesian:
         # Create object with random or defined x, y and random velocity
         if x is None:
-            x = np.random.uniform(min_x, max_x)
+            x = rng.uniform(min_x, max_x)
         if y is None:
-            y = np.random.uniform(min_y, max_y)
-        speed = np.random.uniform(min_speed, max_speed)
-        angle = np.random.uniform(-np.pi, np.pi)
+            y = rng.uniform(min_y, max_y)
+        speed = rng.uniform(min_speed, max_speed)
+        angle = rng.uniform(-np.pi, np.pi)
         x_vel, y_vel = speed * np.cos(angle), speed * np.sin(angle)
 
         # Set update time for when out of bounds, or max interval
@@ -123,9 +126,9 @@ def data_generator(
                     continue
                 kill = object_.out_of_bounds
             else:
-                id_ = np.random.randint(0, dataset_size)
+                id_ = rng.integers(0, dataset_size)
                 while id_ in updated_ids:
-                    id_ = np.random.randint(0, dataset_size)
+                    id_ = rng.integers(0, dataset_size)
                 object_ = objects[id_]
 
             updated_ids.add(object_.id)
@@ -144,12 +147,12 @@ def data_generator(
             yield "INSERT", t_now, object_
 
         for _ in range(queries_per_time_step):
-            x = np.random.uniform(min_x, max_x)
-            y = np.random.uniform(min_y, max_y)
-            dx = np.random.uniform(min_query_extent, max_query_extent)
-            dy = np.random.uniform(min_query_extent, max_query_extent)
-            dt = np.random.randint(min_query_interval, max_query_interval + 1)
-            t = np.random.randint(t_now, t_now + horizon - dt)
+            x = rng.uniform(min_x, max_x)
+            y = rng.uniform(min_y, max_y)
+            dx = rng.uniform(min_query_extent, max_query_extent)
+            dy = rng.uniform(min_query_extent, max_query_extent)
+            dt = rng.integers(min_query_interval, max_query_interval + 1)
+            t = rng.integers(t_now, t_now + horizon - dt)
 
             yield "QUERY", t_now, QueryCartesian(t, t + dt, x, y, dx, dy)
 


=====================================
tox.ini
=====================================
@@ -6,11 +6,11 @@ env_list = py{38,39,310,311,312}
 [testenv]
 description = run unit tests
 deps =
-    pytest
+    pytest>=6
     numpy
 install_command =
     python -I -m pip install --only-binary=:all: {opts} {packages}
 ignore_errors = True
 ignore_outcome = True
 commands =
-    pytest {posargs:tests}
+    pytest --import-mode=importlib {posargs:tests}



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-rtree/-/compare/b59cdc6f59e984ec1885c33c08cf2e22036ef0b8...ae02361b6fb0e115cff0fe3b651c63a911954721

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-rtree/-/compare/b59cdc6f59e984ec1885c33c08cf2e22036ef0b8...ae02361b6fb0e115cff0fe3b651c63a911954721
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/20240710/de72257f/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list