astropy/astropy — pull request #961 by taldcroft (2013-04-09 19:30:00+00:00)
Title: Add format arg to io.ascii read/write and overhaul io.ascii.connect

This PR makes `io.ascii.read() / write()` more consistent with other parts of `astropy` by adding a `format` keyword (as a string) and deprecating the `Reader` and `Writer` keywords (which accept only an `io.ascii` reader classes).
```
# OLD
dat = ascii.read('ipac.dat', Reader=ascii.Ipac)
ascii.write(dat, 'fixed.dat', Writer=ascii.FixedWidth)
# NEW
dat = ascii.read('ipac.dat', format='ipac')
ascii.write(dat, 'fixed.dat', format='fixed_width')
ascii.write(dat, 'out.dat', format='commented_header')
```

In conjunction the I/O registration of `io.ascii` readers/writers has been automated so that *every* format class automatically registers via a base metaclass and class attributes. This removed a bunch of boilerplate code in `io.connect`. There is a new routine that (mostly) generates the sphinx table output which summarizes the [IO registry ascii formats](http://hea-www.harvard.edu/~aldcroft/tmp/astropy-ascii/html/table/io.html#ascii-formats) that are available.

I'm putting this PR out before it is fully baked in order to ask for feedback on the format names for the IO registry. Going in to this I was hesitant to about putting all of the ASCII formats into the registry with their native format name. For instance, with no context this would seem odd to me:
```
dat = Table.read(filename, format='commented_header')
```
With that in mind I made every ASCII format in the registry default to being prefixed by `ascii:`, so it would be
```
dat = Table.read(filename, format='ascii:commented_header')
```
Of course some of the formats *do* make sense in a standalone fashion, like
```
dat = Table.read(filename, format='ipac')
```
This is required anyway for back-compatibility with 0.2. But now when I look at the [registry table](http://hea-www.harvard.edu/~aldcroft/tmp/astropy-ascii/html/table/io.html#ascii-formats) it all looks a bit messy. So this is a call for advice / opinions about how to make this tidy.

cc: @hamogu