Skip to content

ToGo compatibility gaps with Shapely#67

Merged
mindflayer merged 3 commits into
mainfrom
compatibility-gaps
Jun 8, 2026
Merged

ToGo compatibility gaps with Shapely#67
mindflayer merged 3 commits into
mainfrom
compatibility-gaps

Conversation

@mindflayer

Copy link
Copy Markdown
Owner

Summary

This MR closes key ToGo compatibility gaps observed in MBP by improving Shapely-parity APIs and multi-geometry behavior.

What changed

  • Added native module helpers:
    • shape(...) for GeoJSON dict/string and __geo_interface__ inputs
    • box(minx, miny, maxx, maxy, ccw=True)
  • Made multi-geometry symbols class-based for stable typing:
    • MultiPoint and GeometryCollection are now classes (not function factories), improving isinstance behavior.
  • Added Geometry.geoms for multi/collection geometries:
    • Supports MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.
  • Extended Geometry.__getitem__ to support MultiPoint indexing.
  • Improved boundary parity:
    • Polygon.boundary now includes hole boundaries (returns MultiLineString when holes exist).
    • MultiPolygon.boundary now includes boundaries for both exteriors and holes.
  • Exported new helpers via __all__.

Tests

  • Added/updated compatibility coverage in:
    • tests/test_shapely_api.py
    • tests/test_pickle_boundary_compat.py
  • Validated with:

125 passed across tests/test_shapely_api.py and tests/test_pickle_boundary_compat.py.

Why this matters

These changes reduce downstream shims in MBP by providing missing native API surface and more predictable geometry typing/serialization behavior.

Copilot AI review requested due to automatic review settings June 8, 2026 14:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to close key Shapely-compatibility gaps by expanding module-level helpers, stabilizing multi-geometry typing, and improving multi/collection traversal and boundary behavior.

Changes:

  • Added Shapely-style helpers shape(...) (GeoJSON / __geo_interface__) and box(...), and exported them via __all__.
  • Converted MultiPoint and GeometryCollection from factory functions into classes to support stable isinstance checks; added Geometry.geoms for multi/collection child access; extended Geometry.__getitem__ to support MultiPoint indexing.
  • Updated boundary handling for polygonal multi-geometries and expanded test coverage; bumped project version to 0.4.5.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

File Description
togo.pyx Adds shape/box, introduces class-based MultiPoint/GeometryCollection, adds .geoms, extends indexing, and adjusts boundary logic for polygonal geometries.
tests/test_shapely_api.py Adds/extends Shapely-parity tests for shape, box, and .geoms.
tests/test_pickle_boundary_compat.py Extends pickle roundtrip coverage to include MultiPoint and GeometryCollection.
pyproject.toml Bumps version from 0.4.4 to 0.4.5.

Comment thread togo.pyx
Comment thread tests/test_shapely_api.py
@mindflayer mindflayer merged commit 6f931ec into main Jun 8, 2026
7 checks passed
@mindflayer mindflayer deleted the compatibility-gaps branch June 8, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants