Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-export public tools in submodule directories #239

Open
nmaarnio opened this issue Nov 22, 2023 · 1 comment · May be fixed by #361
Open

Re-export public tools in submodule directories #239

nmaarnio opened this issue Nov 22, 2023 · 1 comment · May be fixed by #361
Labels
enhancement New feature or request modification Change to an existing feature

Comments

@nmaarnio
Copy link
Collaborator

nmaarnio commented Nov 22, 2023

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 nmaarnio added enhancement New feature or request modification Change to an existing feature labels Nov 22, 2023
@nialov
Copy link
Collaborator

nialov commented Jan 11, 2024

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.

@nmaarnio nmaarnio linked a pull request Apr 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request modification Change to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants