Re-export open_geotiff and to_geotiff from the top-level xrspatial namespace#3006
Merged
Conversation
Add the two public GeoTIFF entry points to xrspatial/__init__.py so they
import the same way as every other public function:
from xrspatial import open_geotiff, to_geotiff
The existing xrspatial.geotiff.* spelling keeps working. Adds a contract
test pinning both spellings to the same objects and notes the alias in
the GeoTIFF reference docs.
brendancol
commented
Jun 7, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: Re-export open_geotiff and to_geotiff from the top-level xrspatial namespace
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
None.
Nits (optional improvements)
- The two new imports sit between the
zonalandreprojectblocks inxrspatial/__init__.py:144-145. The file isn't strictly module-sorted anyway (hydro is scattered too), so this is fine as is. Ageotiffblock grouped with the other I/O imports would read a touch better, but not enough to warrant a re-push.
What looks good
- Both spellings resolve to the same objects;
xrspatial.open_geotiff is xrspatial.geotiff.open_geotiffholds. - There's no top-level
__all__to keep in sync, so the re-export matches how every other public function is exposed. - The contract test pins identity, not just importability, so it catches a future accidental shadow.
- No circular import: the geotiff subpackage doesn't reach back into the top-level package.
- Backward compatible. The subpackage import keeps working.
- Docs mention the alias in both the Reading and Writing sections.
Checklist
- Algorithm matches reference/paper: n/a (no algorithm change)
- All implemented backends produce consistent results: n/a (no backend change)
- NaN handling is correct: n/a
- Edge cases covered by tests: the identity test covers the contract
- Dask chunk boundaries handled correctly: n/a
- No premature materialization or unnecessary copies: n/a
- Benchmark exists or not needed: not needed
- README feature matrix updated: not applicable (no new function)
- Docstrings present and accurate: docs updated
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 #3005
open_geotiffandto_geotiffwere the only public functions you had to import from the subpackage. Now they re-export from the top level like everything else:xrspatial/__init__.pynext to the other top-level re-exports.from xrspatial.geotiff import open_geotiff, to_geotiffstill works (same objects).No functional change to the readers/writers, so backend coverage (numpy / cupy / dask+numpy / dask+cupy) is untouched.
Test plan
test_top_level_reexports_are_the_subpackage_functionspins both spellings to the same objects.test_api_consolidation.pysuite still passes (14 passed).