[Git][debian-gis-team/python-shapely][experimental] 4 commits: New upstream version 2.0~rc2

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Sat Dec 3 17:28:52 GMT 2022



Bas Couwenberg pushed to branch experimental at Debian GIS Project / python-shapely


Commits:
9411351d by Bas Couwenberg at 2022-12-03T18:17:57+01:00
New upstream version 2.0~rc2
- - - - -
7213b92b by Bas Couwenberg at 2022-12-03T18:17:59+01:00
Update upstream source from tag 'upstream/2.0_rc2'

Update to upstream version '2.0~rc2'
with Debian dir 6078355c843674fbeb8a1593bfcb780364550ca8
- - - - -
ada776ea by Bas Couwenberg at 2022-12-03T18:18:21+01:00
New upstream release candidate.

- - - - -
9f1dc33f by Bas Couwenberg at 2022-12-03T18:20:30+01:00
Set distribution to experimental.

- - - - -


13 changed files:

- .circleci/config.yml
- + .github/dependabot.yml
- .github/workflows/lint.yml
- .github/workflows/release.yml
- debian/changelog
- pyproject.toml
- − shapely/examples/__init__.py
- − shapely/examples/dissolve.py
- − shapely/examples/geoms.py
- − shapely/examples/intersect.py
- shapely/tests/test_creation.py
- shapely/tests/test_io.py
- src/ufuncs.c


Changes:

=====================================
.circleci/config.yml
=====================================
@@ -33,4 +33,10 @@ jobs:
 workflows:
   wheel-build:
     jobs:
-      - linux-aarch64-wheels
+      - linux-aarch64-wheels:
+          filters:
+            branches:
+              only:
+                - main
+            tags:
+              only: /.*/


=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,8 @@
+version: 2
+updates:
+  # Maintain dependencies for GitHub Actions
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      # Check for updates to GitHub Actions every week
+      interval: "weekly"


=====================================
.github/workflows/lint.yml
=====================================
@@ -6,15 +6,15 @@ jobs:
   lint:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout at v2
+      - uses: actions/checkout at v3
 
       - name: Set up Python
-        uses: actions/setup-python at v2
+        uses: actions/setup-python at v4
         with:
           python-version: 3.8
 
       - name: Run black, flake8 and isort
-        uses: pre-commit/action at v2.0.0
+        uses: pre-commit/action at v3.0.0
 
       - name: Validate citation file
         shell: bash


=====================================
.github/workflows/release.yml
=====================================
@@ -113,7 +113,7 @@ jobs:
         if: ${{ matrix.msvc_arch }}
 
       - name: Build wheels
-        uses: pypa/cibuildwheel at v2.10.2
+        uses: pypa/cibuildwheel at v2.11.2
         env:
           CIBW_ARCHS: ${{ matrix.arch }}
           CIBW_SKIP: cp36-* pp* *musllinux* cp310-manylinux_i686
@@ -186,7 +186,7 @@ jobs:
           asset_content_type: application/zip
 
       - name: Upload Release Assets to PyPI
-        uses: pypa/gh-action-pypi-publish at v1.5.1
+        uses: pypa/gh-action-pypi-publish at release/v1
         with:
           user: __token__
           password: ${{ secrets.pypi_password }}


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+python-shapely (2.0~rc2-1~exp1) experimental; urgency=medium
+
+  * New upstream release candidate.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Sat, 03 Dec 2022 18:19:27 +0100
+
 python-shapely (2.0~rc1-1~exp1) experimental; urgency=medium
 
   * New upstream release candidate.


=====================================
pyproject.toml
=====================================
@@ -1,6 +1,6 @@
 [build-system]
 requires = [
-    "cython",
+    "Cython~=0.29",
     "oldest-supported-numpy",
     "setuptools>=61.0.0",
 ]
@@ -57,11 +57,14 @@ docs = [
 Documentation = "https://shapely.readthedocs.io/"
 Repository = "https://github.com/shapely/shapely"
 
+[tool.setuptools]
+include-package-data = false
+
 [tool.setuptools.packages.find]
-include = [
-    "shapely",
-    "shapely.*",
-]
+include = ["shapely", "shapely.*"]
+
+[tool.setuptools.package-data]
+"shapely" = ["*.pxd"]
 
 [tool.coverage.run]
 source = ["shapely"]


=====================================
shapely/examples/__init__.py deleted
=====================================
@@ -1 +0,0 @@
-# Examples module


=====================================
shapely/examples/dissolve.py deleted
=====================================
@@ -1,53 +0,0 @@
-# dissolve.py
-#
-# Demonstrate how Shapely can be used to build up a collection of patches by 
-# dissolving circular regions and how Shapely supports plotting of the results.
-
-from functools import partial
-import random
-
-import pylab
-
-from shapely.geometry import Point
-from shapely.ops import unary_union
-
-# Use a partial function to make 100 points uniformly distributed in a 40x40 
-# box centered on 0,0.
-r = partial(random.uniform, -20.0, 20.0)
-points = [Point(r(), r()) for i in range(100)]
-
-# Buffer the points, producing 100 polygon spots
-spots = [p.buffer(2.5) for p in points]
-
-# Perform a unary union of the polygon spots, dissolving them into a
-# collection of polygon patches
-patches = unary_union(spots)
-
-if __name__ == "__main__":
-    # Illustrate the results using matplotlib's pylab interface
-    pylab.figure(num=None, figsize=(4, 4), dpi=180)
-    
-    for patch in patches.geoms:
-        assert patch.geom_type in ['Polygon']
-        assert patch.is_valid
-    
-        # Fill and outline each patch
-        x, y = patch.exterior.xy
-        pylab.fill(x, y, color='#cccccc', aa=True) 
-        pylab.plot(x, y, color='#666666', aa=True, lw=1.0)
-    
-        # Do the same for the holes of the patch
-        for hole in patch.interiors:
-            x, y = hole.xy
-            pylab.fill(x, y, color='#ffffff', aa=True) 
-            pylab.plot(x, y, color='#999999', aa=True, lw=1.0)
-    
-    # Plot the original points
-    pylab.plot([p.x for p in points], [p.y for p in points], 'b,', alpha=0.75)
-    
-    # Write the number of patches and the total patch area to the figure
-    pylab.text(-25, 25, 
-        f"Patches: {len(patches.geoms)}, total area: {patches.area:.2f}")
-    
-    pylab.savefig('dissolve.png')
-    


=====================================
shapely/examples/geoms.py deleted
=====================================
@@ -1,54 +0,0 @@
-from numpy import asarray
-import pylab
-from shapely.geometry import Point, LineString, Polygon
-
-polygon = Polygon([(-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0), (1.0, -1.0)])
-
-point_r = Point(-1.5, 1.2)
-point_g = Point(-1.0, 1.0)
-point_b = Point(-0.5, 0.5)
-
-line_r = LineString([(-0.5, 0.5), (0.5, 0.5)])
-line_g = LineString([(1.0, -1.0), (1.8, 0.5)])
-line_b = LineString([(-1.8, -1.2), (1.8, 0.5)])
-
-
-def plot_point(g, o, l):
-    pylab.plot([g.x], [g.y], o, label=l)
-
-
-def plot_line(g, o):
-    a = asarray(g)
-    pylab.plot(a[:, 0], a[:, 1], o)
-
-
-def fill_polygon(g, o):
-    a = asarray(g.exterior)
-    pylab.fill(a[:, 0], a[:, 1], o, alpha=0.5)
-
-
-def fill_multipolygon(g, o):
-    for g in g.geoms:
-        fill_polygon(g, o)
-
-
-if __name__ == "__main__":
-    from numpy import asarray
-    import pylab
-
-    fig = pylab.figure(1, figsize=(4, 3), dpi=150)
-    # pylab.axis([-2.0, 2.0, -1.5, 1.5])
-    pylab.axis("tight")
-
-    a = asarray(polygon.exterior)
-    pylab.fill(a[:, 0], a[:, 1], "c")
-
-    plot_point(point_r, "ro", "b")
-    plot_point(point_g, "go", "c")
-    plot_point(point_b, "bo", "d")
-
-    plot_line(line_r, "r")
-    plot_line(line_g, "g")
-    plot_line(line_b, "b")
-
-    pylab.show()


=====================================
shapely/examples/intersect.py deleted
=====================================
@@ -1,88 +0,0 @@
-# intersect.py
-#
-# Demonstrate how Shapely can be used to analyze and plot the intersection of
-# a trajectory and regions in space.
-
-from functools import partial
-import random
-
-import pylab
-
-from shapely.geometry import LineString, Point
-from shapely.ops import unary_union
-
-# Build patches as in dissolved.py
-r = partial(random.uniform, -20.0, 20.0)
-points = [Point(r(), r()) for i in range(100)]
-spots = [p.buffer(2.5) for p in points]
-patches = unary_union(spots)
-
-# Represent the following geolocation parameters
-#
-# initial position: -25, -25
-# heading: 45.0
-# speed: 50*sqrt(2)
-#
-# as a line
-vector = LineString([(-25.0, -25.0), (25.0, 25.0)])
-
-# Find intercepted and missed patches. List the former so we can count them
-# later
-intercepts = [patch for patch in patches.geoms if vector.intersects(patch)]
-misses = (patch for patch in patches.geoms if not vector.intersects(patch))
-
-# Plot the intersection
-intersection = vector.intersection(patches)
-assert intersection.geom_type in ["MultiLineString"]
-
-if __name__ == "__main__":
-    # Illustrate the results using matplotlib's pylab interface
-    pylab.figure(num=None, figsize=(4, 4), dpi=180)
-
-    # Plot the misses
-    for spot in misses:
-        x, y = spot.exterior.xy
-        pylab.fill(x, y, color="#cccccc", aa=True)
-        pylab.plot(x, y, color="#999999", aa=True, lw=1.0)
-
-        # Do the same for the holes of the patch
-        for hole in spot.interiors:
-            x, y = hole.xy
-            pylab.fill(x, y, color="#ffffff", aa=True)
-            pylab.plot(x, y, color="#999999", aa=True, lw=1.0)
-
-    # Plot the intercepts
-    for spot in intercepts:
-        x, y = spot.exterior.xy
-        pylab.fill(x, y, color="red", alpha=0.25, aa=True)
-        pylab.plot(x, y, color="red", alpha=0.5, aa=True, lw=1.0)
-
-        # Do the same for the holes of the patch
-        for hole in spot.interiors:
-            x, y = hole.xy
-            pylab.fill(x, y, color="#ffffff", aa=True)
-            pylab.plot(x, y, color="red", alpha=0.5, aa=True, lw=1.0)
-
-    # Draw the projected trajectory
-    pylab.arrow(
-        -25, -25, 50, 50, color="#999999", aa=True, head_width=1.0, head_length=1.0
-    )
-
-    for segment in intersection.geoms:
-        x, y = segment.xy
-        pylab.plot(x, y, color="red", aa=True, lw=1.5)
-
-    # Write the number of patches and the total patch area to the figure
-    pylab.text(
-        -28,
-        25,
-        "Patches: %d/%d (%d), total length: %.1f"
-        % (
-            len(intercepts),
-            len(patches.geoms),
-            len(intersection.geoms),
-            intersection.length,
-        ),
-    )
-
-    pylab.savefig("intersect.png")


=====================================
shapely/tests/test_creation.py
=====================================
@@ -49,9 +49,12 @@ def test_points_from_xyz():
 
 
 def test_points_invalid_ndim():
-    with pytest.raises(shapely.GEOSException):
+    with pytest.raises(ValueError, match="dimension should be 2 or 3, got 4"):
         shapely.points([0, 1, 2, 3])
 
+    with pytest.raises(ValueError, match="dimension should be 2 or 3, got 1"):
+        shapely.points([0])
+
 
 @pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10")
 def test_points_nan_becomes_empty():


=====================================
shapely/tests/test_io.py
=====================================
@@ -183,7 +183,13 @@ def test_from_wkb_exceptions():
         shapely.from_wkb(1)
 
     # invalid WKB
-    with pytest.raises(shapely.GEOSException, match="Unexpected EOF parsing WKB"):
+    with pytest.raises(
+        shapely.GEOSException,
+        match=(
+            "Unexpected EOF parsing WKB|"
+            "ParseException: Input buffer is smaller than requested object size"
+        ),
+    ):
         result = shapely.from_wkb(b"\x01\x01\x00\x00\x00\x00")
         assert result is None
 
@@ -287,7 +293,7 @@ def test_to_wkt_exceptions():
         shapely.to_wkt(1)
 
     with pytest.raises(shapely.GEOSException):
-        shapely.to_wkt(point, output_dimension=4)
+        shapely.to_wkt(point, output_dimension=5)
 
 
 def test_to_wkt_point_empty():
@@ -403,7 +409,7 @@ def test_to_wkb_exceptions():
         shapely.to_wkb(1)
 
     with pytest.raises(shapely.GEOSException):
-        shapely.to_wkb(point, output_dimension=4)
+        shapely.to_wkb(point, output_dimension=5)
 
     with pytest.raises(ValueError):
         shapely.to_wkb(point, flavor="other")
@@ -442,11 +448,11 @@ def test_to_wkb_srid():
 @pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10.0")
 def test_to_wkb_flavor():
     # http://libgeos.org/specifications/wkb/#extended-wkb
-    actual = shapely.to_wkb(point_z)  # default "extended"
+    actual = shapely.to_wkb(point_z, byte_order=1)  # default "extended"
     assert actual.hex()[2:10] == "01000080"
-    actual = shapely.to_wkb(point_z, flavor="extended")
+    actual = shapely.to_wkb(point_z, byte_order=1, flavor="extended")
     assert actual.hex()[2:10] == "01000080"
-    actual = shapely.to_wkb(point_z, flavor="iso")
+    actual = shapely.to_wkb(point_z, byte_order=1, flavor="iso")
     assert actual.hex()[2:10] == "e9030000"
 
 


=====================================
src/ufuncs.c
=====================================
@@ -2455,6 +2455,14 @@ static void points_func(char** args, npy_intp* dimensions, npy_intp* steps, void
   GEOSCoordSequence* coord_seq = NULL;
   GEOSGeometry** geom_arr;
 
+  // check the ordinate dimension before calling GEOSCoordSeq_create_r
+  if (dimensions[1] < 2 || dimensions[1] > 3) {
+    PyErr_Format(PyExc_ValueError,
+                 "The ordinate (last) dimension should be 2 or 3, got %ld",
+                 dimensions[1]);
+    return;
+  }
+
   // allocate a temporary array to store output GEOSGeometry objects
   geom_arr = malloc(sizeof(void*) * dimensions[0]);
   CHECK_ALLOC(geom_arr);



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/25f97aa15fe37229d20605414ccdd3807f4210e6...9f1dc33fd2921a3bf2532794381328d5a4807904

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/25f97aa15fe37229d20605414ccdd3807f4210e6...9f1dc33fd2921a3bf2532794381328d5a4807904
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/20221203/bc03ad56/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list