Skip to content

Commit

Permalink
Add lazy loading to skimage.future module (#6981)
Browse files Browse the repository at this point in the history
* Add lazy loading to skimage.future module

* Cleanup import

---------

Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
  • Loading branch information
ana42742 and jarrodmillman committed Jun 1, 2023
1 parent e913dd4 commit ea2757c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
13 changes: 2 additions & 11 deletions skimage/future/__init__.py
Expand Up @@ -8,15 +8,6 @@
in production code that will depend on updated skimage versions.
"""

from .manual_segmentation import manual_polygon_segmentation
from .manual_segmentation import manual_lasso_segmentation
from .trainable_segmentation import fit_segmenter, predict_segmenter, TrainableSegmenter
import lazy_loader as lazy


__all__ = [
"manual_lasso_segmentation",
"manual_polygon_segmentation",
"fit_segmenter",
"predict_segmenter",
"TrainableSegmenter",
]
__getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)
14 changes: 14 additions & 0 deletions skimage/future/__init__.pyi
@@ -0,0 +1,14 @@
# Explicitly setting `__all__` is necessary for type inference engines
# to know which symbols are exported. See
# https://peps.python.org/pep-0484/#stub-files

__all__ = [
"manual_lasso_segmentation",
"manual_polygon_segmentation",
"fit_segmenter",
"predict_segmenter",
"TrainableSegmenter",
]

from .manual_segmentation import manual_lasso_segmentation, manual_polygon_segmentation
from .trainable_segmentation import fit_segmenter, predict_segmenter, TrainableSegmenter
1 change: 1 addition & 0 deletions skimage/future/meson.build
@@ -1,5 +1,6 @@
python_sources = [
'__init__.py',
'__init__.pyi',
'manual_segmentation.py',
'trainable_segmentation.py'
]
Expand Down

0 comments on commit ea2757c

Please sign in to comment.