Ensure that skimage2 does not eagerly import skimage#8087
Merged
stefanv merged 7 commits intoscikit-image:mainfrom Mar 12, 2026
Merged
Ensure that skimage2 does not eagerly import skimage#8087stefanv merged 7 commits intoscikit-image:mainfrom
skimage2 does not eagerly import skimage#8087stefanv merged 7 commits intoscikit-image:mainfrom
Conversation
Since a decorator can't be inlined easily but we still want to avoid eagerly importing `skimage` via `skimage2`. The other way round, is okay.
lagru
commented
Mar 12, 2026
Comment on lines
+8
to
+9
| def _default_footprint(func): | ||
| """Decorator to add a default footprint to morphology functions. |
Member
Author
There was a problem hiding this comment.
I've moved this function to skimage2 already, because there's no trivial way to use a decorator "lazily".
This comment was marked as off-topic.
This comment was marked as off-topic.
stefanv
approved these changes
Mar 12, 2026
matthew-brett
added a commit
that referenced
this pull request
Apr 10, 2026
* origin/main: (27 commits) Move `_shared` to `_skimage2` (#8102) Port `pad_footprint` & `mirror_footprint` to `skimage2` (#8094) Add rescaling API to skimage2 (#8075) Move `skimage2` implementation into `_skimage2` (#8093) Undo (double) mirroring in `ski2.morphology.dilation` (#8060) Grammar (#8091) Move `ensure_spacing` into `skimage2` (#8067) Ensure that `skimage2` does not eagerly import `skimage` (#8087) Use lazy-loader 0.5 (#8080) MAINT: make ellipse fitting forward compatible (#8054) Avoid deprecated assign to ndarray.shape (#8020) Avoid circular import in `feature/corner.py` (#8077) Turn off coderabbit auto-labeling & label checks (#8070) Fix GIL being re-enabled by C++ extensions (#8059) Fix conventions following docstub and misc. (#8055) Port grayscale morphology operators to skimage2 (#8046) Add revised `peak_local_max` to `skimage2` (#8039) Allow read-only arrays as input to remap (#7535) Add `prescale` parameter to "blob functions" (#7858) Try to make coderabbit respect exisiting type labels (#8042) ...
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.
Description
We recently discussed establishing a clear import hierarchy between
skimageandskimage2to avoid circular imports. The verdict was:skimagecan importskimage2normally / at the top of modulesskimage2should not importskimage. If it must, it should defer imports / use lazy importsThis PR updates the current code in
skimage2accordingly and enforces the hiearchy with a test.Checklist
./doc/examplesfor new featuresRelease note
For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.