Invalid geometry handling - #5
Merged
Merged
Conversation
Invalid geometries (e.g. self-intersecting polygons) previously crashed with a cryptic "got MultiPolygon" error or silently collapsed to an empty geometry, and behaviour differed between the single / list / GeoDataFrame paths. They are now screened out before any merge/dissolve step and returned unchanged with a warning, consistently across all input types and regardless of merge_collection. The warning is raised from the main process so it survives parallel execution. Also improves the internal error in _generate_starting_point_variants to point at invalid input when a single Polygon unexpectedly becomes multi-part, backfills the missing 0.2.2 changelog entry from git history, and bumps to 0.2.3 with docstring/README notes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror S2Mosaic's tooling onto Smoothify: - .pre-commit-config.yaml: ruff-check + ruff-format + mypy on commit, pytest (skipping slow tests) on pre-push. - GitHub Actions: ci.yml (ruff/mypy/pytest + notebook smoke test, Python 3.10-3.14) and publish.yml (tag-triggered PyPI trusted publishing). - Switch versioning to setuptools-scm (version from git tags); drop the static smoothify/__version__.py and ship a py.typed marker so the inline type hints are exposed to downstream type checkers. - Make the package pass strict mypy and ruff: add missing annotations, reorder the smoothify() overloads (the Any-tainted GeoDataFrame overload must come last), narrow MultiPolygon/MultiLineString construction with a comprehension so both mypy and pyright accept it, trim long lines. - Mark the real-world-data tests `slow`; the pre-push hook deselects them. - Stop tracking uv.lock; add PyPI classifiers, project URLs and license metadata; document the release flow in RELEASING.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- README: add a "Running the Tests" section (uv sync / pytest / coverage). - Expand and refactor tests for geometry-type handling, auto segment-length detection, the smoothify API, core helpers, and invalid-polygon handling. - Refresh visual_tests.ipynb outputs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.