[SciPy-Dev] Question about subpackage/submodule API

Ralf Gommers ralf.gommers at googlemail.com
Sat Feb 12 20:28:53 EST 2011


On Sun, Feb 13, 2011 at 5:05 AM, Pauli Virtanen <pav at iki.fi> wrote:

> On Sat, 12 Feb 2011 14:12:44 -0600, Travis Oliphant wrote:
> > The policy in the past has been that the stable API is only one level
> > down from the scipy namespace.
> >
> > So, developers should import the name from the top level namespace.
> >
>
Is this written down somewhere? As far as I understand this is not standard
practice in Python (one should use underscores). It's also at the moment not
correct in parts of scipy, for example scipy.sparse.linalg.__all__ contains
functions that are not available in sparse.__all__.

Furthermore it would be quite natural to do something like:
    # 4 levels deep, from an actual bug report
    import scipy.sparse.linalg.eigen as eigen
    import scipy.signal.filter_design as filt

> As a subpackage grows, I could see justification for one more level in
> > the stable API --- e.g. scipy.signal.spectral.
> >
> > But, I would be opposed to an API that is deeper than that.
>
> Agreed.
>
> One wild idea to make this clearer could be to prefix all internal sub-
> package names with the usual '_'. In the long run, it probably wouldn't
> be as bad as it initially sounds like.
>
> This is not a wild idea at all, I think it should be done. I considered all
modules without '_' prefix public API.

Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20110213/11593f0f/attachment.html>


More information about the SciPy-Dev mailing list