Closed Balinus closed 5 years ago
You have to add the function name to __name__
.
It's actually to __all__
list in _simple.py
. But not sure we need __all__
in the first place.
Right ! I think we need it to play nicely with the
from _indices import *
and avoid importing non-indices objects.
Right, but it seems that __all__
is containing everything in _simple.py
now so we are not yet leveraging it to hide any non-indices yet. By the time we have non-indices, we can simply put those non-indices in another file and not do import *
of that new file so those non-indices won't be exposed.
Brief, if we get more simple support calls like this, maybe remove the usage of __all__
to not confuse future contributors.
What I meant is that without all, we'd also import logging
, xr
, etc.
Oh true ! I didn't realize import *
will import other modules as well. We're stuck with __all__
then.
Perfect, will try with the proposed solution. Closing this until I can work on this in my local copy. Thanks!
Description
Adding a new index in
_simple.py
is not propagated to the actual indices module. Reproducible steps:def foo():
in_simple.py
ìmport xclim.indices as xci
xci.foo
returnsnote that the indices is accessible bi a direct call. e.g.