Advertise utility functions in `skimage`?

Working on Lazy load legacy imports in skimage top module #6892 has raised the question for me on how our utility functions in our top-level skimage namespace should be treated going forward. The current situation has several problems that I’d like to address:

  • The skimage module includes a manually curated list of submodules and utility functions. This list is hard to keep in sync. E.g. right now the registration subpackage isn’t listed.
  • There’s no skimage.__all__ at runtime (see 6904). dir(skimage) works though.
  • Lazy loading of skimage.data is rendered ineffective by import of data_dir (see #6891).

How do we want the skimage namespace to behave with respect to runtime and inspection tools (that take into account the stub file)?

If we decide to keep advertising utility functions like img_as_float we need to be aware, that they will be duplicated in our HTML documentation and simple references like :func:~img_as_float need to be made more explicit.

I don’t particularly like a duplication in our docs, so my gut feeling right now would be to stop advertising and duplicating the utility functions in skimage but keep them around at runtime indefinitely during “skimage1”. I don’t want to break user code unnecessarily. For skimage2 I’d remove the skimage2 namespace altogether.

Thoughts?

1 Like

+1 to all your proposed actions from me. I always wanted to get rid of those “root” functions. (When I didn’t want all our functions to be root, that is. :joy:)

1 Like

Thanks for commenting. :blush: I updated Lazy load legacy imports in `skimage` top module by lagru · Pull Request #6892 · scikit-image/scikit-image · GitHub accordingly

I concur. I don’t find it ‘clean’ to have these utility functions floating in the root level as well… The question came up in the Data Carpentry lesson and we ‘fixed’ it: Fix call to img_as_ubyte by iimog · Pull Request #232 · datacarpentry/image-processing · GitHub

I assume there is (lazy) consensus, so I’ve updated our skimage2 tracking document with this new TODO item: API changes for skimage2 · scikit-image/scikit-image Wiki · GitHub

1 Like