Skip to content

geotiff: reader kwarg order matches open_geotiff (#1935)#1936

Merged
brendancol merged 1 commit into
mainfrom
rockout-api-consistency-low-geotiff-2026-05-15-01
May 15, 2026
Merged

geotiff: reader kwarg order matches open_geotiff (#1935)#1936
brendancol merged 1 commit into
mainfrom
rockout-api-consistency-low-geotiff-2026-05-15-01

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • read_geotiff_gpu and read_geotiff_dask listed shared keyword-only params in different orders than open_geotiff. All kwargs are keyword-only so callers were not broken positionally, but inspect.signature, IDE autocomplete, and Sphinx-rendered docs all surfaced the drift.
  • open_geotiff is the canonical reference. Swap window and overview_level in read_geotiff_gpu. Reorder read_geotiff_dask so window, overview_level, band, name, chunks, max_pixels line up with the canonical position. read_vrt already conformed.
  • Regression test pins each reader's keyword-only parameter order via inspect.signature and asserts no pairwise inversions across the four entry points.

Mirrors the writer-side fix in #1922 / #1925.

Closes #1935.

Test plan

  • pytest xrspatial/geotiff/tests/test_reader_kwarg_order_1935.py -x -q (5 passed)
  • pytest xrspatial/geotiff/tests/test_backend_kwarg_parity_1561.py xrspatial/geotiff/tests/test_signature_parity_1631.py xrspatial/geotiff/tests/test_signature_annotations_1654.py xrspatial/geotiff/tests/test_signature_annotations_1705.py xrspatial/geotiff/tests/test_kwarg_coverage_2026_05_11_r4.py xrspatial/geotiff/tests/test_kwarg_behaviour_2026_05_12.py xrspatial/geotiff/tests/test_kwarg_behaviour_2026_05_12_v2.py -x -q (107 passed)

read_geotiff_gpu and read_geotiff_dask listed shared keyword-only
params in different orders than open_geotiff. The kwargs are all
keyword-only so callers were not broken, but inspect.signature, IDE
autocomplete, and Sphinx docs all showed the drift.

Pick open_geotiff as the canonical reference (the public dispatcher).
Swap window and overview_level in read_geotiff_gpu. Reorder
read_geotiff_dask so window, overview_level, band, name, chunks,
max_pixels match the canonical position. read_vrt already conformed
and is covered by the new regression test.

Regression test (test_reader_kwarg_order_1935.py) pins each reader's
kw-only param order via inspect.signature and asserts no pairwise
inversions across the four readers, so future kwargs cannot be
added in arbitrary positions.

Mirrors the writer-side fix in #1922 / #1925.
Copilot AI review requested due to automatic review settings May 15, 2026 14:34
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Aligns the keyword-only parameter order of read_geotiff_gpu and read_geotiff_dask with the canonical open_geotiff signature to eliminate drift visible in inspect.signature, IDE autocomplete, and Sphinx docs. Adds a regression test pinning the order across all four reader entry points.

Changes:

  • Swap window / overview_level in read_geotiff_gpu.
  • Reorder read_geotiff_dask kwargs to window, overview_level, band, name, chunks, max_pixels.
  • Add test_reader_kwarg_order_1935.py to enforce canonical order and check no pairwise inversions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
xrspatial/geotiff/_backends/gpu.py Swap order of overview_level and window kwargs to match canonical.
xrspatial/geotiff/_backends/dask.py Reorder kwargs (window, overview_level, band, name, chunks, max_pixels) to match canonical.
xrspatial/geotiff/tests/test_reader_kwarg_order_1935.py New regression test pinning reader kwarg order via inspect.signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@brendancol brendancol merged commit 7914835 into main May 15, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

geotiff: reader kwarg order drift across open_geotiff/read_geotiff_gpu/read_geotiff_dask/read_vrt

2 participants