Repository navigation
Conversation
Introduce a generic fetch() plus sklearn-style fetch_<name>() wrappers for every dataset getter, following the pattern of sklearn.datasets.fetch_* (e.g. fetch_lfw_people). The names make it explicit at the call site that a dataset may need to be downloaded. The bare names (astronaut, camera, ...) are dropped from _skimage2.data's public surface. They remain in _fetchers.py, since skimage1's shim imports them straight from there, bypassing _skimage2.data's public API, so skimage1 is unchanged. skimage1 and skimage2 share docstrings, so _doctest_adapters strips the fetch_ prefix when adapting examples for skimage1, which keeps calling the bare names.
This was referenced Aug 15, 2026
Contributor
|
Reviews (1): Last reviewed commit: "Add skimage2's fetch()/fetch_<name>() da..." | Re-trigger Greptile |
The docstring was written against the follow-up CDN work: it claimed pooch is a normal dependency and that files may come from a scikit-image-data package. Neither holds here. pooch is still optional, carried by the data extra, and scikit-image-data does not exist yet. Describe the resolution order that this branch actually implements, and match the wording _fetch() already uses for the same error.
Readers moving to skimage2 need to know that data.astronaut() is now data.fetch_astronaut(). Add a hand-written section rather than a migration decorator entry, since skimage1 keeps the bare names and nothing is being deprecated there.
Cut the sentence in fetch()'s docstring that restated what the wrappers already show, and trim the alias comment to the part the code does not say: why the bare names stay in this module.
blink1073
force-pushed
the
skimage2-fetch-api
branch
from
September 1, 2026 09:48
b22f27e to
2f3b828
Compare
fetch_astronaut() and friends are now aliases alongside the bare astronaut() names, not replacements for them, so existing skimage2 code keeps working. Update the migration guide and the public-surface test to match.
The .pyi comment called the bare names "aliases of the fetch_*() functions" -- backwards: astronaut is the original, fetch_astronaut = astronaut is the alias. Also cut a sentence in _fetchers.py that only restated what the assignment below it already shows.
fetch_*() is the canonical API; the bare names (e.g. astronaut) stay importable as aliases but leave __all__ and __dir__ so the API reference and tab completion surface only fetch_*. attach_stub derives runtime __all__ from the stub imports, so __init__.py overrides __all__/__dir__ explicitly and the stub keeps the bare names as `x as x` re-exports.
The doctest adapter stripped the fetch_ prefix from any identifier, which could silently corrupt unrelated fetch_* references. Scope it to the known dataset fetcher names so only those are rewritten, and add tests covering both the strip and the no-op cases. Drop the unrelated uv.lock gitignore entry. Also add a test asserting the bare v1 alias (e.g. data.astronaut) is importable and usable but absent from __all__.
Merging upstream main (which includes scikit-image#8310: physical skimage2 sub-package shims) makes skimage2.data a distinct shim module, not the same module as _skimage2.data. The test asserted module identity, which now fails in CI. Assert instead that the shim forwards to the same objects and exposes the same __all__.
test_skimage2_modules_match asserted the ExperimentalAPIWarning fires on 'import skimage2'. My data-surface test imports skimage2 first (with the warning suppressed), so under parallel and Pyodide runs the module is already cached and the warning never re-fires, failing the test. Reload the module inside the assertion to guarantee a fresh import.
blink1073
force-pushed
the
skimage2-fetch-api
branch
from
September 13, 2026 11:07
98207dd to
e4ecbcc
Compare
Preparing the data-fetcher rename: the bare dataset names (e.g. astronaut) are replaced by the fetch_<name>() wrappers. On the skimage2 side, calling skimage2.data.astronaut() now emits a DeprecationWarning pointing to fetch_astronaut. The bare name stays importable during the overlap period while skimage (v1) is maintained, and will be dropped when v1 support is removed. The wrappers are cached so repeated attribute access returns one object. On the skimage (v1) side, the bare names remain the primary API but emit a PendingSkimage2Change warning directing users to the skimage2.fetch_* counterparts; both namespaces stay available during the overlap period. Tests now assert return-value equality between bare and fetch_ names rather than function identity, and verify the deprecation and migration warnings. The migration guide documents the rename once, without per-function entries.
blink1073
force-pushed
the
skimage2-fetch-api
branch
from
September 13, 2026 11:19
e4ecbcc to
f2e0de0
Compare
blink1073
marked this pull request as ready for review
September 27, 2026 22:20
Contributor
|
This AI review is meant to assist maintainers with quick spot checks. You don't need to act on it until you hear from a maintainer. [Medium risk] Updates dataset API naming across the library. The PR appears safe to merge; no new actionable issue was established. Reviews (3) · Last reviewed commit: "Merge branch 'skimage2-fetch-api' of git..." |
lazy_loader caches resolved names in the module __dict__, and eagerly binds every stub name when EAGER_IMPORT is set, so the bare dataset names shadowed their deprecation wrappers after the first access (and were never wrapped at all under eager import). Resolve through the canonical fetch_* name, cache the wrapper in globals, and re-wrap any bare names already bound by eager import.
…e into skimage2-fetch-api
This branch has not been deployed
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.
Add
skimage2.data.fetch()and afetch_<name>()wrapper function per dataset, following the pattern ofsklearn.datasets.fetch_*. The prefix makes it explicit at the call site that a dataset may need downloading.The bare names (
astronaut,camera, ...) will remain importable during the overlap withskimage1,butskimage2now points users to thefetch_wrappers, and the rename is documented in theskimage2migration guide. The data API forskimage(v1) is unchanged.pyteston Python 3.12: 18757 passed (65 skipped, 194 xfailed for optional dependencies).Developed with Claude Code, with all changes and test results reviewed.
Release note (optional)