GispoCoding / eis_toolkit

Python library for mineral prospectivity mapping
https://eis-he.eu/
European Union Public License 1.2
24 stars 8 forks source link

Re-export public tools in submodule directories #239

Open nmaarnio opened 11 months ago

nmaarnio commented 11 months ago

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.

nialov commented 10 months ago

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.