Skip to content

Expose geotiff public functions in __all__ and warn on plot_geotiff#1544

Merged
brendancol merged 2 commits into
mainfrom
geotiff-public-api-all-1541
May 11, 2026
Merged

Expose geotiff public functions in __all__ and warn on plot_geotiff#1544
brendancol merged 2 commits into
mainfrom
geotiff-public-api-all-1541

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • Add read_geotiff_gpu, read_geotiff_dask, read_vrt, and write_geotiff_gpu to xrspatial.geotiff.__all__. They were imported by 9, 5, indirect, and 1 test files respectively but missing from the public API surface, so they had no stability contract and from xrspatial.geotiff import * silently skipped them.
  • Add a real DeprecationWarning to plot_geotiff. The docstring already said "deprecated" but the function emitted no runtime warning, so callers only learned about the deprecation by reading source.
  • Refresh the module docstring's "Public API" block to list every supported entry point.
  • Add a TestPublicAPI class that pins the __all__ set, verifies from ... import * brings each name in, and asserts plot_geotiff stays importable but out of __all__.

Closes #1541

Context

First finding from the geotiff API consistency sweep. Remaining items (gpu kwarg type drift across open_geotiff/to_geotiff/read_geotiff_gpu/read_vrt, sibling-function param asymmetry, the data/dask_data rename in _writer, default chunks drift, and a stale compression list in _writer.write's docstring) are listed in #1541 for follow-up PRs so each fix lands on its own.

Test plan

  • pytest xrspatial/geotiff/tests/ --ignore=xrspatial/geotiff/tests/test_features.py -- 818 passed, 2 skipped.
  • pytest xrspatial/geotiff/tests/test_features.py::TestPublicAPI -- 3 new tests passing.
  • pytest xrspatial/geotiff/tests/test_features.py -- pre-existing matplotlib-recursion failures on test_xrs_plot_* and test_plot_geotiff_deprecated reproduce on main (Python 3.14 + pyparsing). Not introduced here. Otherwise 121 passed (was 118 on main).

read_geotiff_gpu, read_geotiff_dask, read_vrt, and write_geotiff_gpu were
imported by 9, 5, indirect, and 1 test files respectively but were not
listed in __all__, leaving them as orphan public functions: importable
but with no stability contract and silently skipped by `from
xrspatial.geotiff import *`.

Add the four to __all__ and refresh the module docstring so the public
API surface matches what callers already rely on. plot_geotiff stays
out of __all__ since it is deprecated, but now emits a real
DeprecationWarning instead of only documenting the deprecation in its
docstring.

Closes #1541
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 10, 2026
@brendancol brendancol requested a review from Copilot May 10, 2026 19:24
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

This PR tightens the xrspatial.geotiff public API surface by explicitly exporting previously “orphan” production functions via __all__, adds a runtime deprecation warning for plot_geotiff, and introduces tests to pin and validate the exported API.

Changes:

  • Expand xrspatial.geotiff.__all__ to include read_geotiff_gpu, read_geotiff_dask, read_vrt, and write_geotiff_gpu, and update the module “Public API” docstring block accordingly.
  • Add a call-time warning to plot_geotiff and update the existing test to assert the warning is emitted.
  • Add TestPublicAPI tests to freeze/validate __all__ and from xrspatial.geotiff import * behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
xrspatial/geotiff/__init__.py Updates GeoTIFF module public API docs and __all__, and adds a runtime warning for plot_geotiff.
xrspatial/geotiff/tests/test_features.py Adjusts deprecated plotting test to assert a warning and adds new tests that pin/validate __all__ exports.
.claude/sweep-api-consistency-state.csv Records sweep state for the geotiff API consistency work item.

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

Comment thread xrspatial/geotiff/__init__.py Outdated
@brendancol brendancol merged commit fa00718 into main May 11, 2026
11 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: orphan public functions missing from __all__

2 participants