Closed szhorvat closed 3 years ago
Strongly support this 👍
The change should be simple, any one of the following is possible:
__init__.py
, import the names individually instead of using import *
__all__
to define a list of names that should be imported upon import *
_
to make them "private", e.g. import numpy as _np
(probably most code changes needed for this one)Thanks for the feedback @blsqr ! I am not a Python guy, so I wasn't 100% sure about this.
@szhorvat @blsqr Thank you for pointing this out. I have updated the __init__.py
file such that the individual names are imported explicitly rather than using import *
. This change is on the joss_review
branch.
For reference, the relevant commit is 9d964c580e54a2a010fddec90986eac06be6a72a.
Python is not my main language, so it is entirely possible that the "problem" I will mention here is not really considered a problem in the Python community. However, I do not see this issue in polished Python packages.
It is generally convenient to explore a package through the autocompletion feature of Jupyter or your IDE. Thus I like to type
cpl.
, hit tab, and see what is in that namespace. I see a lot of things that do not belong there, such asnp
(fromimport numpy as np
orAxes3D
(which comes from matplotlib).IMO a polished package should control explicitly which symbols are exported and made public.
It is now not clear if the functions I mentioned in #8 are even intended to be public (probably not).