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

Matthew Brett matthew.brett at gmail.com
Mon Jul 27 18:34:47 UTC 2009


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')

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

See you,

Matthew



More information about the Pkg-exppsy-pynifti mailing list