astropy/astropy — pull request #35 by eteq (2011-10-27 10:18:07+00:00)
Title: Config package and data downloaders

This pull request implements the layout of the `config` package, And also implements functionality for remote download/caching of data files and configuration file utility functions.

The remote data aspect of this is ready to go (including tests). One choice I ended up making that could be changed if desired: As it stands right now, data included in the source distribution should live in the astropy/data directory (or subdirectories), rather than in data directories scattered around in each package. If that's strongly desired, it can probably be implemented, although it may require fiddling with setup.py. I shy aware from that because it'll be confusing for future developers - specifically, how does the directory structure of package map onto the directory structure in the data directory? It could be multiple ways, but the simplest thing is to just put them all in one place.

As for the configuration files, there are a few questions to be addressed:

* Should this simple interface (``get_config('subpackagename')``) be it? I could implement a scheme where package authors could just define constants at the top of the modules and have them automatically get passed out to the configuration files (or a new version adopted or whatever), but I wasn't sure what everyone else wanted, so I started with this basic interface (which will be useful in more complicated cases, anyway).
* Right now, the configuration files and remote data cache are in $HOME/.astropy ... given that affiliated packages will want to use this stuff, should we use the ``.astropy`` name? Right now, inside that directory there will be directories with the name e.g. ``astropy`` for the astropy core, ``afpkg1`` for the first afilliated package, and so on... You specify which one you want with the second argument to ``get_config``. This could change to have separate main directories for each affiliate package, but I think this is easier to deal with, as it doens't clutter up the user's home directory.
* In the docstring for ``get_config`` I'm pointing to the configobj web site for definitions of the ConfigObj object and its interface. Should I pull in a copy of the ConfigObj documentation and included it in the sphinx docs (just as a separate html file include in the source dist)?

Once this has been decided on and the pull request completed, I will write up documentation describing how to use these modules in the sphinx docs and issue a new pull request.