geotiff: rename write_vrt's vrt_path kwarg to path (#1946)#1962
Open
brendancol wants to merge 3 commits into
Open
geotiff: rename write_vrt's vrt_path kwarg to path (#1946)#1962brendancol wants to merge 3 commits into
brendancol wants to merge 3 commits into
Conversation
write_vrt's first positional kwarg was vrt_path while to_geotiff and write_geotiff_gpu use path, so callers passing write_vrt(path=...) hit TypeError on the only writer whose docstring advertises parity with the other two. Adds path as the canonical kwarg, keeps vrt_path as a deprecated alias (DeprecationWarning), and raises TypeError if both are supplied. Mirrors the existing crs / crs_wkt shim in the same writer (#1715). Tests pin positional and keyword forms, the deprecation warning on vrt_path, the both-supplied refusal, the cross-writer signature parity, and a round-trip equivalence between the two kwarg names.
4d3061f to
6e46c58
Compare
Contributor
Author
PR Review: geotiff: rename write_vrt's vrt_path kwarg to path (#1946)Blockers (must fix before merge)
Suggestions (should fix, not blocking)
Nits (optional improvements)
What looks good
CI status
Backward compatibility
Checklist
|
…ing TypeError note) Switch write_vrt's path kwarg from a None default to a private _VRT_PATH_MISSING_SENTINEL so an explicit write_vrt(path=None, ...) or positional write_vrt(None, sources) is rejected with a clear TypeError naming the offending kwarg, instead of falling through to the "missing required argument" branch. Mirrors the existing _CRS_WKT_DEPRECATED_SENTINEL pattern in the same writer. Also mirror the crs_wkt entry's "passing both raises TypeError" wording in the write_vrt entry of the geotiff Public API docstring. Updates the test_write_vrt_path_annotated annotation assertion from 'str | None' to 'str' to match the new sentinel-typed default and adds two new regression tests pinning the keyword and positional explicit-None cases.
Contributor
Author
|
Addressed in 9f83e12.
|
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.
Closes #1946.
Summary
write_vrtnow acceptspathas its destination kwarg, matchingto_geotiffandwrite_geotiff_gpu.vrt_pathis kept as a deprecated alias that emitsDeprecationWarning; passing bothpathandvrt_pathraisesTypeError.crs/crs_wktshim in the same writer (geotiff: write_vrt's crs_wkt kwarg drifts from to_geotiff/write_geotiff_gpu's crs #1715) and uses the same sentinel pattern (_VRT_PATH_DEPRECATED_SENTINELin_runtime.py).Why
xrspatial.geotiffexposes three writers that the docstring advertises as parity siblings.to_geotiffandwrite_geotiff_gpuusepath;write_vrtwas usingvrt_path, sowrite_vrt(path=...)failed withTypeError: unexpected keyword argumentdespite the writer trio claiming a shared surface. Detected by the deep-sweep-api-consistency sweep.Test plan
pytest xrspatial/geotiff/tests/test_write_vrt_path_kwarg_1946.py— 8 new tests pass locallywrite_vrt(path, sources)works without warningwrite_vrt(path=..., source_files=...)works without warningwrite_vrt(vrt_path=...)works and emitsDeprecationWarningTypeErrorTypeErrorinspect.signaturepinspathas the first positional argto_geotiff/write_geotiff_gpu/write_vrtall usepath)