ipython/ipython — pull request #2328 by gregcaporaso (2012-08-23 10:05:15+00:00)
Title: addition of classes to generate a link or list of links from files local to the IPython HTML notebook

This pull request derives from work I did for a QIIME (www.qiime.org) workshop that was run in Copenhagen on August 18. Similar functionality now exists in QIIME, but I'd like to remove that in favor of having it in the IPython code base as it seems like it would be generally useful. We're going to start using IPython more in our QIIME workshops, and this makes interacting with output much easier.

Motivation:
QIIME often generates file output that ends up living under the `files/` directory when working in the IPython notebook. We'd like to easily be able to link to that output from within the IPython notebook. To do this now users manually construct a link, as we did in the QIIME/IPython/StarCluster paper (Ragen-Kelley et al., in press at ISME Journal). These new classes would simplify this - see this usage example, which should be run from within the IPython HTML notebook:

```
from IPython.display import LocalFile, LocalFiles
!echo "Hello world!" > hello.txt
!mkdir hello
!echo "Hello again!" > hello/test1.txt
!echo "Hello yet again!" > hello/test2.txt

# print link to single file
LocalFile('hello.txt')
# print links to all files under the 'hello' directory, recursively
LocalFiles('hello')
```

Does similar functionality already exist in IPython that I should be using instead? If so, can you point me to that? If not, and you're interested in including this, I'd like to follow up with some additional documentation and tests before you pull this.

A couple of questions if you are interested in including this (or more likely some derivation of this, after getting feedback from the dev group):
- Is there a better place for these classes? I looked through what I thought were the likely places.
- Where should test code go for this?
- Should there be additions to the sphinx documentation?
- Any general stylistic comments to make it more IPython-like?