[Git][debian-gis-team/python-shapely][master] 5 commits: New upstream version 2.0.3
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Fri Feb 16 19:21:11 GMT 2024
Bas Couwenberg pushed to branch master at Debian GIS Project / python-shapely
Commits:
bc184dd1 by Bas Couwenberg at 2024-02-16T20:13:33+01:00
New upstream version 2.0.3
- - - - -
80f77d51 by Bas Couwenberg at 2024-02-16T20:13:35+01:00
Update upstream source from tag 'upstream/2.0.3'
Update to upstream version '2.0.3'
with Debian dir adaffc5d70be8c9ff5a618c1f98ea29d969627d1
- - - - -
3d773789 by Bas Couwenberg at 2024-02-16T20:13:51+01:00
New upstream release.
- - - - -
800d7dcd by Bas Couwenberg at 2024-02-16T20:15:15+01:00
Update copyright file.
- - - - -
62e156d6 by Bas Couwenberg at 2024-02-16T20:16:20+01:00
Set distribution to unstable.
- - - - -
23 changed files:
- .circleci/config.yml
- .github/workflows/release.yml
- .github/workflows/tests.yml
- .readthedocs.yml
- .travis.yml
- CHANGES.txt
- CITATION.cff
- debian/changelog
- debian/copyright
- − docs/_static/custom.css
- docs/conf.py
- docs/release/2.x.rst
- pyproject.toml
- shapely/_version.py
- shapely/algorithms/_oriented_envelope.py
- shapely/constructive.py
- shapely/decorators.py
- shapely/tests/common.py
- shapely/tests/geometry/test_format.py
- shapely/tests/test_constructive.py
- shapely/tests/test_misc.py
- shapely/tests/test_set_operations.py
- shapely/tests/test_strtree.py
Changes:
=====================================
.circleci/config.yml
=====================================
@@ -9,7 +9,7 @@ jobs:
# https://circleci.com/product/features/resource-classes/
resource_class: arm.medium
environment:
- GEOS_VERSION: 3.11.2
+ GEOS_VERSION: 3.11.3
CIBUILDWHEEL: 1
CIBW_BUILD: "cp*-manylinux_aarch64"
CIBW_ENVIRONMENT_PASS_LINUX: "GEOS_VERSION GEOS_INSTALL GEOS_CONFIG LD_LIBRARY_PATH"
@@ -21,7 +21,7 @@ jobs:
- run:
name: Build the Linux aarch64 wheels.
command: |
- python3 -m pip install --user cibuildwheel==2.16.2
+ python3 -m pip install --user cibuildwheel==2.16.5
echo 'export GEOS_INSTALL=~/linux-aarch64-wheels/geosinstall/geos-"$GEOS_VERSION"' >> "$BASH_ENV"
echo 'export GEOS_CONFIG="$GEOS_INSTALL"/bin/geos-config' >> "$BASH_ENV"
echo 'export LD_LIBRARY_PATH="$GEOS_INSTALL"/lib' >> "$BASH_ENV"
=====================================
.github/workflows/release.yml
=====================================
@@ -46,7 +46,7 @@ jobs:
name: Build ${{ matrix.arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
- GEOS_VERSION: "3.11.2"
+ GEOS_VERSION: "3.11.3"
strategy:
fail-fast: false
matrix:
@@ -114,7 +114,7 @@ jobs:
if: ${{ matrix.msvc_arch }}
- name: Build wheels
- uses: pypa/cibuildwheel at v2.16.2
+ uses: pypa/cibuildwheel at v2.16.5
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: cp36-* pp* *musllinux* *-manylinux_i686
=====================================
.github/workflows/tests.yml
=====================================
@@ -14,7 +14,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
architecture: [x64]
- geos: [3.6.6, 3.7.5, 3.8.3, 3.9.4, 3.10.5, 3.11.2, 3.12.0, main]
+ geos: [3.6.6, 3.7.5, 3.8.4, 3.9.5, 3.10.6, 3.11.3, 3.12.1, main]
include:
# 2017
- python: 3.7 # 3.6 is dropped
@@ -26,26 +26,26 @@ jobs:
numpy: 1.15.4
# 2019
- python: 3.8
- geos: 3.8.3
+ geos: 3.8.4
numpy: 1.16.2
# 2020
- python: 3.9
- geos: 3.9.4
+ geos: 3.9.5
numpy: 1.19.5
# 2021
- python: "3.10"
- geos: 3.10.5
+ geos: 3.10.6
numpy: 1.21.3
# 2022
- python: "3.11"
- geos: 3.11.2
+ geos: 3.11.3
numpy: 1.23.4
matplotlib: true
doctest: true
extra_pytest_args: "-W error" # error on warnings
# 2023
- python: "3.12"
- geos: 3.12.0
+ geos: 3.12.1
numpy: 1.26.0
# dev
- python: "3.12"
@@ -61,12 +61,12 @@ jobs:
- os: windows-2019
architecture: x86
python: 3.9
- geos: 3.10.3
+ geos: 3.10.6
numpy: 1.19.5
# pypy (use explicit ubuntu version to not overwrite existing ubuntu-latest + geos 3.11.0 build)
- os: ubuntu-20.04
python: "pypy3.8"
- geos: 3.11.2
+ geos: 3.11.3
numpy: 1.23.4
env:
=====================================
.readthedocs.yml
=====================================
@@ -9,6 +9,14 @@ build:
os: "ubuntu-20.04"
tools:
python: "mambaforge-4.10"
+ jobs:
+ post_checkout:
+ # we need the tags for versioneer to work
+ - git fetch origin --depth 150
+ - git fetch --tags
+ pre_install:
+ # to avoid "dirty" version
+ - git update-index --assume-unchanged docs/environment.yml docs/conf.py
# Build documentation in the docs/ directory with Sphinx
sphinx:
@@ -23,5 +31,5 @@ conda:
python:
install:
- - method: setuptools
+ - method: pip
path: .
=====================================
.travis.yml
=====================================
@@ -7,7 +7,7 @@ if: (branch = main OR tag IS present) AND (type = push)
env:
global:
- - GEOS_VERSION=3.11.2
+ - GEOS_VERSION=3.11.3
cache:
directories:
=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,15 @@
Changes
=======
+2.0.3 (2024-02-16)
+------------------
+
+- Fix regression in the ``oriented_envelope`` ufunc to accept array-like input
+ in case of GEOS<3.12 (#1929).
+- The binary wheels are not yet compatible with a future NumPy 2.0 release,
+ therefore a ``numpy<2`` upper pin was added to the requirements (#1972).
+- Upgraded the GEOS version in the binary wheel distributions to 3.11.3.
+
2.0.2 (2023-10-12)
------------------
=====================================
CITATION.cff
=====================================
@@ -2,8 +2,8 @@ cff-version: 1.2.0
message: "Please cite this software using these metadata."
type: software
title: Shapely
-version: "2.0.2"
-date-released: "2023-10-12"
+version: "2.0.3"
+date-released: "2024-02-16"
doi: 10.5281/zenodo.5597138
abstract: "Manipulation and analysis of geometric objects in the Cartesian plane."
repository-artifact: https://pypi.org/project/Shapely
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+python-shapely (2.0.3-1) unstable; urgency=medium
+
+ * New upstream release.
+ * Update copyright file.
+
+ -- Bas Couwenberg <sebastic at debian.org> Fri, 16 Feb 2024 20:16:09 +0100
+
python-shapely (2.0.2-2) unstable; urgency=medium
* Fix autopkgtest failure.
=====================================
debian/copyright
=====================================
@@ -4,7 +4,7 @@ Upstream-Contact: Gis Python community list <community at lists.gispython.org>
Source: https://github.com/shapely/shapely
Files: *
-Copyright: 2007-2023, Shapely Contributors
+Copyright: 2007-2024, Shapely Contributors
2019, Casper van der Wel
2007, Sean Gillies <sgillies at frii.com>
License: BSD-3-clause
=====================================
docs/_static/custom.css deleted
=====================================
@@ -1,12 +0,0 @@
-/*Copied from sphinx' basic.css to ensure the sphinx >2.0 docstrings are
-rendered somewhat properly (xref https://github.com/numpy/numpydoc/issues/215) */
-
-.classifier {
- font-style: oblique;
-}
-
-.classifier:before {
- font-style: normal;
- margin: 0.5em;
- content: ":";
-}
=====================================
docs/conf.py
=====================================
@@ -12,7 +12,7 @@ os.environ["SPHINX_DOC_BUILD"] = "1"
# -- Project information -----------------------------------------------------
project = 'Shapely'
-copyright = '2011-2023, Sean Gillies and Shapely contributors'
+copyright = '2011-2024, Sean Gillies and Shapely contributors'
# The full version, including alpha/beta/rc tags.
import shapely
@@ -53,9 +53,9 @@ html_theme = "sphinx_book_theme"
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
-html_css_files = [
- 'custom.css',
-]
+# html_css_files = [
+# 'custom.css',
+# ]
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
=====================================
docs/release/2.x.rst
=====================================
@@ -1,6 +1,22 @@
Version 2.x
===========
+.. _version-2-0-3:
+
+Version 2.0.3 (2024-02-16)
+--------------------------
+
+Bug fixes:
+
+- Fix regression in the ``oriented_envelope`` ufunc to accept array-like input
+ in case of GEOS<3.12 (#1929).
+
+Packaging related:
+
+- The binary wheels are not yet compatible with a future NumPy 2.0 release,
+ therefore a ``numpy<2`` upper pin was added to the requirements (#1972).
+- Upgraded the GEOS version in the binary wheel distributions to 3.11.3.
+
.. _version-2-0-2:
Version 2.0.2 (2023-10-12)
=====================================
pyproject.toml
=====================================
@@ -38,7 +38,7 @@ classifiers = [
]
requires-python = ">=3.7"
dependencies = [
- "numpy>=1.14",
+ "numpy>=1.14,<2",
]
[project.optional-dependencies]
=====================================
shapely/_version.py
=====================================
@@ -25,9 +25,9 @@ def get_keywords():
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
- git_refnames = " (tag: 2.0.2, maint-2.0)"
- git_full = "8d45d434037267ba9b1f1de409d1b5396d6c9219"
- git_date = "2023-10-12 21:49:31 +0200"
+ git_refnames = " (tag: 2.0.3, maint-2.0)"
+ git_full = "76e77f00491490f031d6eb3e45059b907cc6b79c"
+ git_date = "2024-02-16 14:59:28 +0100"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
=====================================
shapely/algorithms/_oriented_envelope.py
=====================================
@@ -17,8 +17,6 @@ def _oriented_envelope_min_area(geometry, **kwargs):
"""
if geometry is None:
return None
- if not hasattr(geometry, "geom_type"):
- return np.array([_oriented_envelope_min_area(g) for g in geometry])
if geometry.is_empty:
return shapely.from_wkt("POLYGON EMPTY")
@@ -53,3 +51,8 @@ def _oriented_envelope_min_area(geometry, **kwargs):
# check for the minimum area rectangle and return it
transf_rect, inv_matrix = min(_transformed_rects(), key=lambda r: r[0].area)
return affine_transform(transf_rect, inv_matrix)
+
+
+_oriented_envelope_min_area_vectorized = np.frompyfunc(
+ _oriented_envelope_min_area, 1, 1
+)
=====================================
shapely/constructive.py
=====================================
@@ -2,7 +2,7 @@ import numpy as np
from shapely import lib
from shapely._enum import ParamEnum
-from shapely.algorithms._oriented_envelope import _oriented_envelope_min_area
+from shapely.algorithms._oriented_envelope import _oriented_envelope_min_area_vectorized
from shapely.decorators import multithreading_enabled, requires_geos
__all__ = [
@@ -1028,7 +1028,7 @@ def oriented_envelope(geometry, **kwargs):
<POLYGON EMPTY>
"""
if lib.geos_version < (3, 12, 0):
- f = _oriented_envelope_min_area
+ f = _oriented_envelope_min_area_vectorized
else:
f = _oriented_envelope_geos
return f(geometry, **kwargs)
=====================================
shapely/decorators.py
=====================================
@@ -39,7 +39,7 @@ class requires_geos:
# Insert the message at the first double newline
position = doc.find("\n\n") + 2
# Figure out the indentation level
- indent = 2
+ indent = 0
while True:
if doc[position + indent] == " ":
indent += 1
=====================================
shapely/tests/common.py
=====================================
@@ -92,3 +92,34 @@ def ignore_invalid(condition=True):
with ignore_invalid():
line_string_nan = shapely.LineString([(np.nan, np.nan), (np.nan, np.nan)])
+
+
+class ArrayLike:
+ """
+ Simple numpy Array like class that implements the
+ ufunc protocol.
+ """
+
+ def __init__(self, array):
+ self._array = np.asarray(array)
+
+ def __len__(self):
+ return len(self._array)
+
+ def __getitem(self, key):
+ return self._array[key]
+
+ def __iter__(self):
+ return self._array.__iter__()
+
+ def __array__(self):
+ return np.asarray(self._array)
+
+ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
+ if method == "__call__":
+ inputs = [
+ arg._array if isinstance(arg, self.__class__) else arg for arg in inputs
+ ]
+ return self.__class__(ufunc(*inputs, **kwargs))
+ else:
+ return NotImplemented
=====================================
shapely/tests/geometry/test_format.py
=====================================
@@ -84,23 +84,28 @@ def test_format_polygon():
assert format(poly, "X") == poly.wkb_hex
# Use f-strings with extra characters and rounding precision
- assert f"<{poly:.2f}>" == (
- "<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
- "-10.00 -0.00, -7.07 7.07, -0.00 10.00, 7.07 7.07, 10.00 0.00))>"
- )
+ if geos_version < (3, 13, 0):
+ assert f"<{poly:.2f}>" == (
+ "<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
+ "-10.00 -0.00, -7.07 7.07, -0.00 10.00, 7.07 7.07, 10.00 0.00))>"
+ )
+ else:
+ assert f"<{poly:.2f}>" == (
+ "<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
+ "-10.00 0.00, -7.07 7.07, 0.00 10.00, 7.07 7.07, 10.00 0.00))>"
+ )
# 'g' format varies depending on GEOS version
if geos_version < (3, 10, 0):
- expected_2G = (
+ assert f"{poly:.2G}" == (
"POLYGON ((10 0, 7.1 -7.1, 1.6E-14 -10, -7.1 -7.1, "
"-10 -3.2E-14, -7.1 7.1, -4.6E-14 10, 7.1 7.1, 10 0))"
)
else:
- expected_2G = (
+ assert f"{poly:.2G}" == (
"POLYGON ((10 0, 7.07 -7.07, 0 -10, -7.07 -7.07, "
"-10 0, -7.07 7.07, 0 10, 7.07 7.07, 10 0))"
)
- assert f"{poly:.2G}" == expected_2G
# check empty
empty = Polygon()
=====================================
shapely/tests/test_constructive.py
=====================================
@@ -17,6 +17,7 @@ from shapely import (
from shapely.testing import assert_geometries_equal
from shapely.tests.common import (
all_types,
+ ArrayLike,
empty,
empty_line_string,
empty_point,
@@ -981,6 +982,17 @@ def test_oriented_envelope_pre_geos_312(geometry, expected):
assert_geometries_equal(actual, expected, normalize=True, tolerance=1e-3)
+def test_oriented_evelope_array_like():
+ # https://github.com/shapely/shapely/issues/1929
+ # because we have a custom python implementation, need to ensure this has
+ # the same capabilities as numpy ufuncs to work with array-likes
+ geometries = [Point(1, 1).buffer(1), Point(2, 2).buffer(1)]
+ actual = shapely.oriented_envelope(ArrayLike(geometries))
+ assert isinstance(actual, ArrayLike)
+ expected = shapely.oriented_envelope(geometries)
+ assert_geometries_equal(np.asarray(actual), expected)
+
+
@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11")
def test_concave_hull_kwargs():
p = Point(10, 10)
=====================================
shapely/tests/test_misc.py
=====================================
@@ -1,5 +1,6 @@
import os
import sys
+from inspect import cleandoc
from itertools import chain
from string import ascii_letters, digits
from unittest import mock
@@ -83,13 +84,22 @@ class SomeClass:
"""
-expected_docstring = """Docstring that will be mocked.
+def expected_docstring(**kwds):
+ doc = """Docstring that will be mocked.
{indent}A multiline.
{indent}.. note:: 'func' requires at least GEOS {version}.
{indent}Some description.
-{indent}"""
+{indent}""".format(
+ **kwds
+ )
+ if sys.version_info[:2] >= (3, 13):
+ # There are subtle differences between inspect.cleandoc() and
+ # _PyCompile_CleanDoc(). Most significantly, the latter does not remove
+ # leading or trailing blank lines.
+ return cleandoc(doc) + "\n"
+ return doc
@pytest.mark.parametrize("version", ["3.7.0", "3.7.1", "3.6.2"])
@@ -104,7 +114,7 @@ def test_requires_geos_not_ok(version, mocked_geos_version):
with pytest.raises(shapely.errors.UnsupportedGEOSVersionError):
wrapped()
- assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 4)
+ assert wrapped.__doc__ == expected_docstring(version=version, indent=" " * 4)
@pytest.mark.parametrize("version", ["3.6.0", "3.8.0"])
@@ -112,7 +122,7 @@ def test_requires_geos_doc_build(version, mocked_geos_version, sphinx_doc_build)
"""The requires_geos decorator always adapts the docstring."""
wrapped = requires_geos(version)(func)
- assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 4)
+ assert wrapped.__doc__ == expected_docstring(version=version, indent=" " * 4)
@pytest.mark.parametrize("version", ["3.6.0", "3.8.0"])
@@ -120,7 +130,7 @@ def test_requires_geos_method(version, mocked_geos_version, sphinx_doc_build):
"""The requires_geos decorator adjusts methods docstrings correctly"""
wrapped = requires_geos(version)(SomeClass.func)
- assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 8)
+ assert wrapped.__doc__ == expected_docstring(version=version, indent=" " * 8)
@multithreading_enabled
=====================================
shapely/tests/test_set_operations.py
=====================================
@@ -53,6 +53,13 @@ non_polygon_types = [
@pytest.mark.parametrize("a", all_types)
@pytest.mark.parametrize("func", SET_OPERATIONS)
def test_set_operation_array(a, func):
+ if (
+ func is shapely.difference
+ and a.geom_type == "GeometryCollection"
+ and shapely.get_num_geometries(a) == 2
+ and shapely.geos_version == (3, 9, 5)
+ ):
+ pytest.xfail("GEOS 3.9.5 crashes with mixed collection")
actual = func(a, point)
assert isinstance(actual, Geometry)
=====================================
shapely/tests/test_strtree.py
=====================================
@@ -10,7 +10,7 @@ import pytest
from numpy.testing import assert_array_equal
import shapely
-from shapely import box, geos_version, MultiPoint, Point, STRtree
+from shapely import box, geos_version, LineString, MultiPoint, Point, STRtree
from shapely.errors import UnsupportedGEOSVersionError
from shapely.testing import assert_geometries_equal
from shapely.tests.common import (
@@ -928,12 +928,12 @@ def test_query_crosses_polygons(poly_tree, geometry, expected):
# box contains points but touches only those at edges
(box(3, 3, 6, 6), [3, 6]),
([box(3, 3, 6, 6)], [[0, 0], [3, 6]]),
- # buffer completely contains point in tree
+ # polygon completely contains point in tree
(shapely.buffer(Point(3, 3), 1), []),
([shapely.buffer(Point(3, 3), 1)], [[], []]),
- # buffer intersects 2 points but touches only one
- (shapely.buffer(Point(0, 1), 1), [1]),
- ([shapely.buffer(Point(0, 1), 1)], [[0], [1]]),
+ # linestring intersects 2 points but touches only one
+ (LineString([(-1, -1), (1, 1)]), [1]),
+ ([LineString([(-1, -1), (1, 1)])], [[0], [1]]),
# multipoints intersect but not valid relation
(MultiPoint([[5, 5], [7, 7]]), []),
([MultiPoint([[5, 5], [7, 7]])], [[], []]),
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/3474ca264b2cce21d4817eb6b733e2a0c7772316...62e156d64be71fde4d5a3891805a114a832913a4
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/3474ca264b2cce21d4817eb6b733e2a0c7772316...62e156d64be71fde4d5a3891805a114a832913a4
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/20240216/1cfc4123/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list