[Git][debian-gis-team/python-shapely][master] 4 commits: New upstream version 2.0.4
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Wed Apr 17 04:34:14 BST 2024
Bas Couwenberg pushed to branch master at Debian GIS Project / python-shapely
Commits:
a8d141af by Bas Couwenberg at 2024-04-17T05:14:20+02:00
New upstream version 2.0.4
- - - - -
94a153d3 by Bas Couwenberg at 2024-04-17T05:14:21+02:00
Update upstream source from tag 'upstream/2.0.4'
Update to upstream version '2.0.4'
with Debian dir 2c2daa2bdba122b3ac0ab04d5fac08519cfdf2a7
- - - - -
e70bda9b by Bas Couwenberg at 2024-04-17T05:14:33+02:00
New upstream release.
- - - - -
8757fd24 by Bas Couwenberg at 2024-04-17T05:16:09+02:00
Set distribution to unstable.
- - - - -
15 changed files:
- .circleci/config.yml
- .github/workflows/release.yml
- .github/workflows/tests.yml
- CHANGES.txt
- CITATION.cff
- debian/changelog
- docs/release/2.x.rst
- pyproject.toml
- shapely/_ragged_array.py
- shapely/_version.py
- shapely/geometry/polygon.py
- shapely/testing.py
- shapely/tests/test_io.py
- shapely/tests/test_ragged_array.py
- src/ufuncs.c
Changes:
=====================================
.circleci/config.yml
=====================================
@@ -13,9 +13,11 @@ jobs:
CIBUILDWHEEL: 1
CIBW_BUILD: "cp*-manylinux_aarch64"
CIBW_ENVIRONMENT_PASS_LINUX: "GEOS_VERSION GEOS_INSTALL GEOS_CONFIG LD_LIBRARY_PATH"
+ CIBW_ENVIRONMENT: "PIP_PRE=1"
CIBW_BEFORE_ALL: "./ci/install_geos.sh"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest --pyargs shapely.tests"
+ CIBW_BUILD_VERBOSITY: 1
steps:
- checkout
- run:
=====================================
.github/workflows/release.yml
=====================================
@@ -119,17 +119,20 @@ jobs:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: cp36-* pp* *musllinux* *-manylinux_i686
CIBW_ENVIRONMENT_LINUX:
+ PIP_PRE=1
GEOS_VERSION=${{ env.GEOS_VERSION }}
GEOS_INSTALL=/host${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}
GEOS_CONFIG=/host${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}/bin/geos-config
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/host${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}/lib
CIBW_ENVIRONMENT_MACOS:
+ PIP_PRE=1
GEOS_INSTALL=${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}
GEOS_CONFIG=${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}/bin/geos-config
LDFLAGS=-Wl,-rpath,${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}/lib
MACOSX_DEPLOYMENT_TARGET=10.9
CMAKE_OSX_ARCHITECTURES='${{ matrix.cmake_osx_architectures }}'
CIBW_ENVIRONMENT_WINDOWS:
+ PIP_PRE=1
GEOS_INSTALL='${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}'
GEOS_LIBRARY_PATH='${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}\lib'
GEOS_INCLUDE_PATH='${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}\include'
@@ -139,6 +142,7 @@ jobs:
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path ${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}\bin -w {dest_dir} {wheel}
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest --pyargs shapely.tests
+ CIBW_BUILD_VERBOSITY: 1
- name: Upload artifacts
uses: actions/upload-artifact at v3
=====================================
.github/workflows/tests.yml
=====================================
@@ -161,8 +161,15 @@ jobs:
if: ${{ matrix.os == 'windows-2019' }}
- name: Build and install Shapely
+ # for the numpy nightly build, we temporarily need to build without
+ # the standard build isolation based on build-system.requires, to
+ # ensure we build against numpy nightly (numpy 2.0 compat)
run: |
- pip install -e .
+ if [ -z "${{ matrix.numpy }}" ]; then
+ pip install -e . --no-build-isolation
+ else
+ pip install -e .
+ fi
- name: Overview of the Python environment (pip list)
run: pip list
=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,17 @@
Changes
=======
+2.0.4 (2024-04-16)
+------------------
+
+Wheels for Python versions >= 3.9 will be compatible with the upcoming NumPy 2.0
+release (as well as with supported NumPy 1.x versions).
+
+Bug fixes:
+
+- Fix bug in ``to_wkt`` with multiple empty Z geometries (#2012).
+- Fix bug in ``to_ragged_array`` for an array of Points with missing values (#2034).
+
2.0.3 (2024-02-16)
------------------
=====================================
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.3"
-date-released: "2024-02-16"
+version: "2.0.4"
+date-released: "2024-04-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,9 @@
+python-shapely (2.0.4-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Wed, 17 Apr 2024 05:16:00 +0200
+
python-shapely (2.0.3-1) unstable; urgency=medium
* New upstream release.
=====================================
docs/release/2.x.rst
=====================================
@@ -1,6 +1,19 @@
Version 2.x
===========
+.. _version-2-0-4:
+
+Version 2.0.4 (2024-04-16)
+--------------------------
+
+Bug fixes:
+
+- Fix bug in ``to_wkt`` with multiple empty Z geometries (#2012).
+- Fix bug in ``to_ragged_array`` for an array of Points with missing values (#2034).
+
+Wheels for Python versions >= 3.9 will be compatible with the upcoming NumPy 2.0
+release (as well as with supported NumPy 1.x versions).
+
.. _version-2-0-3:
Version 2.0.3 (2024-02-16)
=====================================
pyproject.toml
=====================================
@@ -1,7 +1,12 @@
[build-system]
requires = [
"Cython",
- "oldest-supported-numpy",
+ # Starting with NumPy 1.25, NumPy is (by default) as far back compatible
+ # as oldest-support-numpy was (customizable with a NPY_TARGET_VERSION
+ # define). For older Python versions (where NumPy 1.25 is not yet avaiable)
+ # continue using oldest-support-numpy.
+ "oldest-supported-numpy; python_version<'3.9'",
+ "numpy>=1.25; python_version>='3.9'",
"setuptools>=61.0.0",
]
build-backend = "setuptools.build_meta"
@@ -38,7 +43,7 @@ classifiers = [
]
requires-python = ">=3.7"
dependencies = [
- "numpy>=1.14,<2",
+ "numpy>=1.14,<3",
]
[project.optional-dependencies]
=====================================
shapely/_ragged_array.py
=====================================
@@ -37,7 +37,7 @@ from shapely._geometry import (
get_type_id,
)
from shapely.coordinates import get_coordinates
-from shapely.predicates import is_empty
+from shapely.predicates import is_empty, is_missing
__all__ = ["to_ragged_array", "from_ragged_array"]
@@ -50,7 +50,8 @@ def _get_arrays_point(arr, include_z):
coords = get_coordinates(arr, include_z=include_z)
# empty points are represented by NaNs
- empties = is_empty(arr)
+ # + missing geometries should also be present with some value
+ empties = is_empty(arr) | is_missing(arr)
if empties.any():
indices = np.nonzero(empties)[0]
indices = indices - np.arange(len(indices))
=====================================
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.3, maint-2.0)"
- git_full = "76e77f00491490f031d6eb3e45059b907cc6b79c"
- git_date = "2024-02-16 14:59:28 +0100"
+ git_refnames = " (tag: 2.0.4, maint-2.0)"
+ git_full = "3853e1170173125b7e86cbb5cc8dab1c274c3999"
+ git_date = "2024-04-16 23:57:44 +0200"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
=====================================
shapely/geometry/polygon.py
=====================================
@@ -10,7 +10,7 @@ from shapely.geometry.base import BaseGeometry
from shapely.geometry.linestring import LineString
from shapely.geometry.point import Point
-__all__ = ["Polygon", "LinearRing"]
+__all__ = ["orient", "Polygon", "LinearRing"]
def _unpickle_linearring(wkb):
=====================================
shapely/testing.py
=====================================
@@ -106,8 +106,8 @@ def assert_geometries_equal(
if normalize:
x = shapely.normalize(x)
y = shapely.normalize(y)
- x = np.array(x, copy=False)
- y = np.array(y, copy=False)
+ x = np.asarray(x)
+ y = np.asarray(y)
is_scalar = x.ndim == 0 or y.ndim == 0
=====================================
shapely/tests/test_io.py
=====================================
@@ -287,6 +287,15 @@ def test_to_wkt_none():
assert shapely.to_wkt(None) is None
+def test_to_wkt_array_with_empty_z():
+ # See GH-2004
+ empty_wkt = ["POINT Z EMPTY", None, "POLYGON Z EMPTY"]
+ empty_geoms = shapely.from_wkt(empty_wkt)
+ if shapely.geos_version < (3, 9, 0):
+ empty_wkt = ["POINT EMPTY", None, "POLYGON EMPTY"]
+ assert list(shapely.to_wkt(empty_geoms)) == empty_wkt
+
+
def test_to_wkt_exceptions():
with pytest.raises(TypeError):
shapely.to_wkt(1)
=====================================
shapely/tests/test_ragged_array.py
=====================================
@@ -110,18 +110,30 @@ def test_points():
"POINT EMPTY",
"POINT EMPTY",
"POINT (4 4)",
+ None,
"POINT EMPTY",
]
)
typ, result, offsets = shapely.to_ragged_array(arr)
expected = np.array(
- [[0, 0], [1, 1], [np.nan, np.nan], [np.nan, np.nan], [4, 4], [np.nan, np.nan]]
+ [
+ [0, 0],
+ [1, 1],
+ [np.nan, np.nan],
+ [np.nan, np.nan],
+ [4, 4],
+ [np.nan, np.nan],
+ [np.nan, np.nan],
+ ]
)
assert typ == shapely.GeometryType.POINT
+ assert len(result) == len(arr)
assert_allclose(result, expected)
assert len(offsets) == 0
geoms = shapely.from_ragged_array(typ, result)
+ # in a roundtrip, missing geometries come back as empty
+ arr[-2] = shapely.from_wkt("POINT EMPTY")
assert_geometries_equal(geoms, arr)
@@ -133,6 +145,7 @@ def test_linestrings():
"LINESTRING EMPTY",
"LINESTRING EMPTY",
"LINESTRING (10 10, 20 20, 10 40)",
+ None,
"LINESTRING EMPTY",
]
)
@@ -151,13 +164,15 @@ def test_linestrings():
[10.0, 40.0],
]
)
- expected_offsets = np.array([0, 3, 7, 7, 7, 10, 10])
+ expected_offsets = np.array([0, 3, 7, 7, 7, 10, 10, 10])
assert typ == shapely.GeometryType.LINESTRING
assert_allclose(coords, expected)
assert len(offsets) == 1
assert_allclose(offsets[0], expected_offsets)
result = shapely.from_ragged_array(typ, coords, offsets)
+ # in a roundtrip, missing geometries come back as empty
+ arr[-2] = shapely.from_wkt("LINESTRING EMPTY")
assert_geometries_equal(result, arr)
@@ -169,6 +184,7 @@ def test_polygons():
"POLYGON EMPTY",
"POLYGON EMPTY",
"POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))",
+ None,
"POLYGON EMPTY",
]
)
@@ -197,7 +213,7 @@ def test_polygons():
]
)
expected_offsets1 = np.array([0, 5, 10, 14, 19])
- expected_offsets2 = np.array([0, 1, 3, 3, 3, 4, 4])
+ expected_offsets2 = np.array([0, 1, 3, 3, 3, 4, 4, 4])
assert typ == shapely.GeometryType.POLYGON
assert_allclose(coords, expected)
@@ -206,6 +222,8 @@ def test_polygons():
assert_allclose(offsets[1], expected_offsets2)
result = shapely.from_ragged_array(typ, coords, offsets)
+ # in a roundtrip, missing geometries come back as empty
+ arr[-2] = shapely.from_wkt("POLYGON EMPTY")
assert_geometries_equal(result, arr)
@@ -217,6 +235,7 @@ def test_multipoints():
"MULTIPOINT EMPTY",
"MULTIPOINT EMPTY",
"MULTIPOINT (30 10, 10 30, 40 40)",
+ None,
"MULTIPOINT EMPTY",
]
)
@@ -233,7 +252,7 @@ def test_multipoints():
[40.0, 40.0],
]
)
- expected_offsets = np.array([0, 4, 5, 5, 5, 8, 8])
+ expected_offsets = np.array([0, 4, 5, 5, 5, 8, 8, 8])
assert typ == shapely.GeometryType.MULTIPOINT
assert_allclose(coords, expected)
@@ -241,6 +260,8 @@ def test_multipoints():
assert_allclose(offsets[0], expected_offsets)
result = shapely.from_ragged_array(typ, coords, offsets)
+ # in a roundtrip, missing geometries come back as empty
+ arr[-2] = shapely.from_wkt("MULTIPOINT EMPTY")
assert_geometries_equal(result, arr)
@@ -252,6 +273,7 @@ def test_multilinestrings():
"MULTILINESTRING EMPTY",
"MULTILINESTRING EMPTY",
"MULTILINESTRING ((35 10, 45 45), (15 40, 10 20), (30 10, 10 30, 40 40))",
+ None,
"MULTILINESTRING EMPTY",
]
)
@@ -278,7 +300,7 @@ def test_multilinestrings():
]
)
expected_offsets1 = np.array([0, 3, 6, 10, 12, 14, 17])
- expected_offsets2 = np.array([0, 1, 3, 3, 3, 6, 6])
+ expected_offsets2 = np.array([0, 1, 3, 3, 3, 6, 6, 6])
assert typ == shapely.GeometryType.MULTILINESTRING
assert_allclose(coords, expected)
@@ -287,6 +309,8 @@ def test_multilinestrings():
assert_allclose(offsets[1], expected_offsets2)
result = shapely.from_ragged_array(typ, coords, offsets)
+ # in a roundtrip, missing geometries come back as empty
+ arr[-2] = shapely.from_wkt("MULTILINESTRING EMPTY")
assert_geometries_equal(result, arr)
@@ -298,6 +322,7 @@ def test_multipolygons():
"MULTIPOLYGON EMPTY",
"MULTIPOLYGON EMPTY",
"MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)))",
+ None,
"MULTIPOLYGON EMPTY",
]
)
@@ -335,7 +360,7 @@ def test_multipolygons():
)
expected_offsets1 = np.array([0, 5, 9, 13, 19, 23, 27])
expected_offsets2 = np.array([0, 2, 3, 5, 6])
- expected_offsets3 = np.array([0, 1, 3, 3, 3, 4, 4])
+ expected_offsets3 = np.array([0, 1, 3, 3, 3, 4, 4, 4])
assert typ == shapely.GeometryType.MULTIPOLYGON
assert_allclose(coords, expected)
@@ -345,6 +370,8 @@ def test_multipolygons():
assert_allclose(offsets[2], expected_offsets3)
result = shapely.from_ragged_array(typ, coords, offsets)
+ # in a roundtrip, missing geometries come back as empty
+ arr[-2] = shapely.from_wkt("MULTIPOLYGON EMPTY")
assert_geometries_equal(result, arr)
=====================================
src/ufuncs.c
=====================================
@@ -3351,8 +3351,9 @@ static void to_wkt_func(char** args, const npy_intp* dimensions, const npy_intp*
goto finish;
}
if (wkt != NULL) {
+ Py_XDECREF(*out);
*out = PyUnicode_FromString(wkt);
- goto finish;
+ continue;
}
#else
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/62e156d64be71fde4d5a3891805a114a832913a4...8757fd24b525dd1581411a51fab41bc132f19e4f
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/62e156d64be71fde4d5a3891805a114a832913a4...8757fd24b525dd1581411a51fab41bc132f19e4f
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/20240417/3926d06f/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list