Skip to content

[shapely] Changes for new features and updates made in Release 2.2.0 - #16562

Open
jack-volantautonomy wants to merge 13 commits into
python:mainfrom
jack-volantautonomy:shapely-2_2_0-typeshed-update
Open

jack-volantautonomy wants to merge 13 commits into
python:mainfrom
jack-volantautonomy:shapely-2_2_0-typeshed-update

Conversation

@jack-volantautonomy

Copy link
Copy Markdown
Contributor

This PR aims to provide type support for the latest 2.2.0 release in shapely which comes with new features, deprecations, and more tweaks.

@github-actions

This comment has been minimized.

@jack-volantautonomy
jack-volantautonomy marked this pull request as draft October 19, 2026 09:47
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@thomas-maschler

Copy link
Copy Markdown
Contributor

Thanks for picking this up! A few things from checking against shapely 2.2.0 at runtime:

  • split and minimum_width return an ndarray for array input, so the sequence overloads should return GeoArray. The first three minimum_width overloads can collapse into Geometry -> LineString, since they all return the same type. Also, with GEOS older than 3.15 (including the bundled 3.14.1 wheels), split falls back to ops.split, and split(None, p) raises AttributeError.
  • The lib.*_scalar functions are internal fast paths, and there are 109 of them at runtime. Allowlisting them would be simpler than stubbing them: shapely\.lib\..*_scalar in @tests/stubtest_allowlist.txt.
  • Stubtest still flags coverage_clean and lib.minimum_width as missing, lib.make_valid as removed, the __new__ parameter rename from self to cls on the geometry classes, BaseGeometry.__nonzero__, ParamEnum.has_value, and the _version changes from the meson build.
  • Stubtest can't catch these: prepare and destroy_prepared now return bool (#2359), and ops.transform and multithreading_enabled are deprecated in 2.2.0, so they could get @deprecated.
  • The pyrefly crash looks unrelated. Rebasing on main should clear it.

@github-actions

This comment has been minimized.

@jack-volantautonomy

Copy link
Copy Markdown
Contributor Author

Hey @thomas-maschler, sorry for not getting to this sooner but thanks for the help, much appreciated! I'm fairly new to typeshed work and wasn't aware of the allowlist so that was a great help as it was getting pretty tiring!

I think the PR is much more ready now after working through your comment and finishing off the remaining stuff. Marking it as ready for review and would be great if you could take another look. Cheers 👍

@jack-volantautonomy
jack-volantautonomy marked this pull request as ready for review October 28, 2026 16:11
@github-actions

This comment has been minimized.

@thomas-maschler thomas-maschler 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.

Thanks, this looks much better! The stubtest items are all resolved. I left a few inline suggestions; two more things outside the diff:

  • prepare and destroy_prepared in creation.pyi now return bool (#2359) but are still typed -> None.
  • ops.transform (DeprecationWarning) and decorators.multithreading_enabled (FutureWarning) are deprecated in 2.2.0 and could get @deprecated.

Comment thread stubs/shapely/shapely/_coverage.pyi Resolved
Comment thread stubs/shapely/shapely/_coverage.pyi Resolved
Comment thread stubs/shapely/shapely/constructive.pyi Resolved
Comment thread stubs/shapely/METADATA.toml Resolved
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
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.

2 participants