[Pkg-exppsy-pynifti] [Nipy-devel] Data packaging, a proposal for feedback

Gael Varoquaux gael.varoquaux at normalesup.org
Tue Jul 28 05:41:50 UTC 2009


On Mon, Jul 27, 2009 at 11:34:47AM -0700, Matthew Brett wrote:
> Hi,

> > Just adding something like the following lines to an __init__.py:

> >   from nipy.utils import make_datasource
> >   templates = make_datasource('nipy', 'templates')

> > So that the user can simply import the name 'templates' from eg
> > nipy.utils. These lines are simply taken from the documentation, so it is
> > nothing more than a helper, but I believe that there is a lot of value to
> > it.

> Yes, I agree completely.  In fact, that's how I wrote it first.  The
> problem is, what happens if the data is not there?  Specifically, if I
> do:

> from nipy.utils.data import templates

> fname = templates.get_filename('some','file', 'T1.nii')

> - and there is not nipy/templates data package installed - what should I see?

> I guess, optionally:

> warning('Tried to make a templates datasource, but there was no data ...')

> followed by (not optional):

> DataError('No nipy templates package found')

Yes, this looks good.

> - but - should that warning happen at every import?  Even if the
> package works fine without the nipy templates data?  Probably not.

Yes, I agree with that: no warnings at import.

Gaël



More information about the Pkg-exppsy-pynifti mailing list