geotiff: annotate open_geotiff(max_cloud_bytes=...) (#2106)#2108
Merged
brendancol merged 2 commits intoMay 19, 2026
Merged
Conversation
The docstring already declared ``int or None``, but the function signature carried a bare parameter -- the only kwarg on the public read/write surface without a type annotation. ``inspect.signature``, IDE autocomplete, Sphinx output, and ``mypy --strict`` all saw the gap. Adds ``int | None`` to the annotation; default stays the module-internal ``_MAX_CLOUD_BYTES_SENTINEL`` so behaviour is unchanged. Regression test pins the immediate fix and parametrises over every public reader/writer entry point so a future kwarg addition without an annotation surfaces in CI. Also updates ``.claude/sweep-api-consistency-state.csv`` with the 2026-05-18 sweep results.
Contributor
Author
PR Review: geotiff: annotate open_geotiff(max_cloud_bytes=...) (#2106)BlockersNone. SuggestionsNone. Nits
What looks good
Checklist
|
Two follow-ups from review on #2108: 1. ``open_geotiff(max_cloud_bytes=...)`` annotation: ``int | None`` is the caller-facing contract, but the default ``_MAX_CLOUD_BYTES_SENTINEL`` is an ``object()``. ``mypy --strict`` flagged ``Incompatible default for argument`` ([assignment]). Add ``# type: ignore[assignment]`` so the line is clean under strict mode while keeping the user-facing annotation untouched. The pre-existing ``on_gpu_failure`` and ``missing_sources`` sentinels follow the same pattern and remain out of scope. 2. ``test_open_geotiff_max_cloud_bytes_has_type_annotation``: the substring check ``"int" in s and "None" in s`` would also pass on ``Mapping[int, None]``. Pin the exact ``int | None`` form. The parametrized test below still acts as a presence-only check for the rest of the public reader/writer surface.
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 #2106.
Summary
open_geotiff(max_cloud_bytes=...)was the only kwarg on the public read/write surface without a Python type annotation; the docstring already declaredint or Noneso the surface and the docs disagreedint | Noneto the annotation. Default stays the module-internal_MAX_CLOUD_BYTES_SENTINELso behaviour is unchangedopen_geotiff,read_geotiff_gpu,read_geotiff_dask,read_vrt,to_geotiff,write_geotiff_gpu,write_vrt) so a future addition without an annotation surfaces in CIWhy this matters
inspect.signatureis the source of truth for IDE autocomplete, Sphinx output, andmypy --strict. A bare parameter blocks the static-typing path for the only fsspec-related kwarg on the public read entry pointOut of scope
Test plan
pytest xrspatial/geotiff/tests/test_open_geotiff_max_cloud_bytes_annot_2106.py -v(8 passed)pytest xrspatial/geotiff/tests/test_reader_kwarg_order_1935.py xrspatial/geotiff/tests/test_writer_kwarg_order_1922.py -v(existing parity tests still pass)open_geotiffround-trip withmax_cloud_bytes=...,max_cloud_bytes=None, and the existinggpu=True + max_cloud_bytes=...rejection guard all still workread_geotiff_gpureturns CuPy-backed DataArray, gpu+max_cloud_bytes rejection still fires)Filed by deep-sweep api-consistency on 2026-05-18.