Skip to content

Commit 3ec30a9

Browse files
committed
DOC: update data pkg doc for implementation
Data packages implemented already according to this spec, but in nibabel rather than nipy.
1 parent 0b99f87 commit 3ec30a9

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

doc/source/devel/data_pkg_design.rst

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _data-package-design:
22

3-
Design of data packages for the nipy suite
4-
==========================================
3+
Design of data packages for the nibabel and the nipy suite
4+
==========================================================
55

66
See :ref:`data-package-discuss` for a more general discussion of design
77
issues.
@@ -17,7 +17,8 @@ data files nipy uses into at least 3 categories
1717
Files used for routine testing are typically very small data files. They are
1818
shipped with the software, and live in the code repository. For example, in
1919
the case of ``nipy`` itself, there are some test files that live in the module
20-
path ``nipy.testing.data``.
20+
path ``nipy.testing.data``. Nibabel ships data files in
21+
``nibabel.tests.data``. See :doc:`add_test_data` for discussion.
2122

2223
*template data* and *example data* are example of *data packages*. What
2324
follows is a discussion of the design and use of data packages.
@@ -45,7 +46,7 @@ Use cases for data packages
4546
Using the data package
4647
``````````````````````
4748

48-
The programmer will want to use the data something like this:
49+
The programmer can use the data like this:
4950

5051
.. testcode::
5152

@@ -78,9 +79,9 @@ found, and how it should be installed.
7879
Warnings during installation
7980
````````````````````````````
8081

81-
The example data and template data may be important, and it would be
82-
useful to warn the user if NIPY cannot find either of the two sets of
83-
data when installing the package. Thus::
82+
The example data and template data may be important, and so we want to warn
83+
the user if NIPY cannot find either of the two sets of data when installing
84+
the package. Thus::
8485

8586
python setup.py install
8687

@@ -98,23 +99,22 @@ install the data.
9899
Finding the data
99100
````````````````
100101

101-
The routine ``make_datasource`` will need to be able to find the data
102-
that has been installed. For the following call:
102+
The routine ``make_datasource`` will look for data packages that have been
103+
installed. For the following call:
103104

104105
>>> templates = make_datasource(dict(relpath='nipy/templates'))
105106

106-
We propose to:
107+
the code will:
107108

108109
#. Get a list of paths where data is known to be stored with
109-
``nipy.data.get_data_path()``
110+
``nibabel.data.get_data_path()``
110111
#. For each of these paths, search for directory ``nipy/templates``. If
111112
found, and of the correct format (see below), return a datasource,
112113
otherwise raise an Exception
113114

114-
The paths collected by ``nipy.data.get_data_paths()`` will be
115-
constructed from ':' (Unix) or ';' separated strings. The source of the
116-
strings (in the order in which they will be used in the search above)
117-
are:
115+
The paths collected by ``nibabel.data.get_data_paths()`` are constructed from
116+
':' (Unix) or ';' separated strings. The source of the strings (in the order
117+
in which they will be used in the search above) are:
118118

119119
#. The value of the ``NIPY_DATA_PATH`` environment variable, if set
120120
#. A section = ``DATA``, parameter = ``path`` entry in a
@@ -126,8 +126,8 @@ are:
126126
``/etc/nipy`` on Unix, and some suitable equivalent on Windows.
127127
#. The result of ``os.path.join(sys.prefix, 'share', 'nipy')``
128128
#. If ``sys.prefix`` is ``/usr``, we add ``/usr/local/share/nipy``. We
129-
need this because Python 2.6 in Debian / Ubuntu does default installs
130-
to ``/usr/local``.
129+
need this because Python >= 2.6 in Debian / Ubuntu does default installs to
130+
``/usr/local``.
131131
#. The result of ``get_nipy_user_dir()``
132132

133133
Requirements for a data package
@@ -175,7 +175,7 @@ packages have been installed::
175175
`-- config.ini
176176

177177
The ``<ROOT>`` directory is the directory that will appear somewhere in
178-
the list from ``nipy.data.get_data_path()``. The ``nipy`` subdirectory
178+
the list from ``nibabel.data.get_data_path()``. The ``nipy`` subdirectory
179179
signifies data for the ``nipy`` package (as opposed to other
180180
NIPY-related packages such as ``pbrain``). The ``data`` subdirectory of
181181
``nipy`` contains files from the ``nipy-data`` package. In the
@@ -192,9 +192,8 @@ giving the version of the data package.
192192
Installing the data
193193
```````````````````
194194

195-
We will use python distutils to install data packages, and the
196-
``data_files`` mechanism to install the data. On Unix, with the
197-
following command::
195+
We use python distutils to install data packages, and the ``data_files``
196+
mechanism to install the data. On Unix, with the following command::
198197

199198
python setup.py install --prefix=/my/prefix
200199

@@ -211,8 +210,8 @@ because ``nipy`` is both the project, and the package to which the data
211210
relates.
212211

213212
If you install to a particular location, you will need to add that location to
214-
the output of ``nipy.data.get_data_path()`` using one of the mechanisms above,
215-
for example, in your system configuration::
213+
the output of ``nibabel.data.get_data_path()`` using one of the mechanisms
214+
above, for example, in your system configuration::
216215

217216
export NIPY_DATA_PATH=/my/prefix/share/nipy
218217

0 commit comments

Comments
 (0)