Each NIPY subpackage should include an api.py module that exports its API classes, functions, constants, and interfaces. This has several benefits:
- Helps distinguish between the public and private portions of our code, since api.py is an obvious choice to look at when browsing a package to see what it has to offer.
- Putting imports in __init__.py files means that anyone who tries to use something from the package will have perform all the imports.
- Packaging and code organization is made easier when using setuptools if the __init__.py is essentially empty. In particular, if we want to distribute NIPY as a collection of smaller eggs (e.g., an FMRI egg, a SPECT egg, an EEG egg) we can use Namespace Packages, which requires that __init__.py has no meaningful data.
- It is a convention gaining widespread adoption including, for example, enthought, peak, trac, zope.
In practive this should enable us to have shorter, more intuitive paths to frequently used things. For example, rather than
from neuroimaging.core.image.image import Image
we might write
from neuroimaging.core.api import Image