-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release 1.4.0 #218
release 1.4.0 #218
Conversation
Adding the Hypothesis cache dir to .gitignore Grammar fixes in geometry.py Hypothesis dep in pyproject.toml without version peg Initial strategies in conftest.py. This is the only file name I could use that didn't cause an issue with the name-tests-test pre-commit hook. 'strategies.py' would be better because strictly speaking these aren't fixtures. An example test for encode/decode invariance.
updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.14 → v0.2.0](astral-sh/ruff-pre-commit@v0.1.14...v0.2.0) - [github.com/python-jsonschema/check-jsonschema: 0.27.3 → 0.27.4](python-jsonschema/check-jsonschema@0.27.3...0.27.4)
for more information, see https://pre-commit.ci
[pre-commit.ci] pre-commit autoupdate
updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.0 → v0.2.1](astral-sh/ruff-pre-commit@v0.2.0...v0.2.1) - [github.com/python-jsonschema/check-jsonschema: 0.27.4 → 0.28.0](python-jsonschema/check-jsonschema@0.27.4...0.28.0)
[pre-commit.ci] pre-commit autoupdate
updates: - [github.com/psf/black: 24.1.1 → 24.2.0](psf/black@24.1.1...24.2.0) - [github.com/astral-sh/ruff-pre-commit: v0.2.1 → v0.2.2](astral-sh/ruff-pre-commit@v0.2.1...v0.2.2)
[pre-commit.ci] pre-commit autoupdate
updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](astral-sh/ruff-pre-commit@v0.2.2...v0.3.2) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](pre-commit/mirrors-mypy@v1.8.0...v1.9.0)
[pre-commit.ci] pre-commit autoupdate
updates: - [github.com/psf/black: 24.2.0 → 24.3.0](psf/black@24.2.0...24.3.0) - [github.com/astral-sh/ruff-pre-commit: v0.3.2 → v0.3.3](astral-sh/ruff-pre-commit@v0.3.2...v0.3.3)
[pre-commit.ci] pre-commit autoupdate
updates: - [github.com/psf/black: 23.10.1 → 23.11.0](psf/black@23.10.1...23.11.0) - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.5](astral-sh/ruff-pre-commit@v0.1.4...v0.1.5) - [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.7.0](pre-commit/mirrors-mypy@v1.6.1...v1.7.0)
updates: - [github.com/hakancelikdev/unimport: 1.0.0 → 1.1.0](hakancelikdev/unimport@1.0.0...1.1.0) - [github.com/astral-sh/ruff-pre-commit: v0.1.5 → v0.1.6](astral-sh/ruff-pre-commit@v0.1.5...v0.1.6)
it cannot be guaranteed that objects which compare equal have the same hash value
updates: - [github.com/pre-commit/mirrors-mypy: v1.7.0 → v1.7.1](pre-commit/mirrors-mypy@v1.7.0...v1.7.1) - [github.com/python-jsonschema/check-jsonschema: 0.27.1 → 0.27.2](python-jsonschema/check-jsonschema@0.27.1...0.27.2)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]>
179 add hypothesis tests
updates: - [github.com/astral-sh/ruff-pre-commit: v0.3.3 → v0.3.4](astral-sh/ruff-pre-commit@v0.3.3...v0.3.4)
[pre-commit.ci] pre-commit autoupdate
Review changes with SemanticDiff. Analyzed 21 of 30 files. Overall, the semantic diff is 5% smaller than the GitHub diff. File Information
|
Important Auto Review SkippedAuto reviews are disabled on base/target branches other than the default branch. Please add the base/target branch pattern to the list of additional branches to be reviewed in the settings. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Hello @cleder! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
PR Summary
|
PR Description updated to latest commit (881b457) |
PR-Agent was enabled for this repository. To use it, please link your git user with your CodiumAI identity here. PR Description updated to latest commit (881b457)
|
PR-Agent was enabled for this repository. To use it, please link your git user with your CodiumAI identity here. PR Review
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
PR Review
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @cleder - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 6 issues found
- 🟢 Complexity: all looks good
- 🟢 Docstrings: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
def dedupe(coords: LineType) -> LineType: | ||
"""Remove duplicate Points from a LineString.""" | ||
return cast(LineType, tuple(coord for coord, _count in groupby(coords))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Consider using a set for deduplication to improve efficiency.
Using a set to remove duplicates before casting back to a tuple might be more efficient than relying on groupby, especially for large datasets.
def _hull(points: Iterable[Point2D]) -> List[Point2D]: | ||
"""Construct the upper/lower hull of a set of points.""" | ||
stack: List[Point2D] = [] | ||
for p in points: | ||
while ( | ||
len(hull) >= 2 and _cross(o=hull[-2], a=hull[-1], b=p) <= 0 # noqa: PLR2004 | ||
len(stack) >= 2 # noqa: PLR2004 | ||
and _orientation(stack[-2], stack[-1], p) >= 0 | ||
): | ||
hull.pop() | ||
hull.append(p) | ||
return hull | ||
stack.pop() | ||
stack.append(p) | ||
return stack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Ensure that points are sorted before constructing the hull.
The algorithm assumes that points are pre-sorted. If they're not, the resulting hull might not be correct. Consider adding a sort operation if not already handled.
|
||
|
||
@given(geometry_collections(srs=epsg4326)) | ||
def test_from_wkt_epsg_4326(multi_poly: geometry.GeometryCollection) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Consider renaming multi_poly
to geom_collection
for clarity.
The variable name multi_poly
might be misleading in the context of testing GeometryCollection
. A name like geom_collection
would more accurately reflect the tested type.
@@ -0,0 +1,45 @@ | |||
"""Test MultiPolygons with Hypothesis.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (testing): Update the module docstring to reflect the correct test subject.
The current docstring suggests that the module tests MultiPolygons
, but it actually tests GeometryCollection
. Please update it accordingly.
) | ||
|
||
|
||
@given(geometry_collections(srs=epsg4326, has_z=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Add tests for mixed dimensionality within GeometryCollection
.
Currently, the tests either use 2D or 3D geometries exclusively. It would be beneficial to add a test case that includes a mix of 2D and 3D geometries within a single GeometryCollection
to ensure proper handling of mixed dimensionality.
assert multi_point == from_wkt(str(multi_point)) | ||
|
||
|
||
@given(multi_points()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Verify individual points in MultiPoint
after convex hull operation.
While the test checks the bounds of the convex hull against the MultiPoint
, it would be more thorough to also verify that each point within the MultiPoint
is correctly represented in the convex hull.
assert poly == from_wkt(str(poly)) | ||
|
||
|
||
@given(polygons()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Ensure Polygon
interiors are preserved after convex hull operation.
The test verifies the bounds of the convex hull, but it should also check that the interiors (holes) of the Polygon
are correctly handled or explicitly document the expected behavior if they are not preserved.
assert line == from_wkt(str(line)) | ||
|
||
|
||
@given(line_strings()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Add test for LineString
simplification.
In addition to testing the convex hull, consider adding a test case for LineString
simplification to ensure that the simplification process retains the essential shape of the LineString
.
User description
Type
enhancement, tests
Description
pygeoif/hypothesis/strategies.py
.tests/hypothesis/test_geometrycollection.py
.pygeoif/about.py
.docs/HISTORY.rst
.pyproject.toml
.Changes walkthrough
strategies.py
Add Hypothesis Strategies for Geometry Test Data Generation
pygeoif/hypothesis/strategies.py
geometry types.
optional spatial reference system (SRS) support.
Polygons, MultiPoints, MultiLineStrings, MultiPolygons, and
GeometryCollections with customizable parameters.
test data generation.
about.py
Update Version Number to 1.4.0
pygeoif/about.py
test_geometrycollection.py
Implement Hypothesis Tests for GeometryCollection
tests/hypothesis/test_geometrycollection.py
repr
andshape
functions forGeometryCollection objects.
HISTORY.rst
Document Changes in Version 1.4.0
docs/HISTORY.rst
in version 1.4.0.
pyproject.toml
Add Hypothesis Dependency and Update Python Version Requirement
pyproject.toml