eis_toolkit icon indicating copy to clipboard operation
eis_toolkit copied to clipboard

Re-export public tools in submodule directories

Open nmaarnio opened this issue 1 year ago • 1 comments

Currently, users need to access the tools like this: from eis_toolkit.raster_processing.resampling import resample

It would be more convenient (and common in other libraries) to import like this: from eis_toolkit.raster_processing import resample

This can be achieved by re-exporting the public functions in __init__.py files of each submodule directory (e.g. raster_processing). For example: from .resampling import resample

It's also worth considering for the 1.0.0 release if the files with source code should be prefixed with _ to indicate they are not meant to be imported.

nmaarnio avatar Nov 22 '23 10:11 nmaarnio

I usually prefer as explicit imports as possible as then it is clear where a function is defined. Most of all I hate running into __init__.py files that have wildcard imports so you have no idea where the function is defined. However, in eis_toolkit, with how most Python function files usually only contain a single main function (e.g. resample in resampling.py), I am not strongly against this either as there will probably not be issues with finding the original function definition.

nialov avatar Jan 11 '24 12:01 nialov