PyLookup Django: Django Documentation Lookup in Emacs

Edit: I’ve submitted a pull request that will render step 3 obsolete. I will update this article when it’s merged. These instructions can also be used for NumPy.

Edit edit: The pull request has been merged, rendering step 3 obsolete. These instructions are now effectively the same as those in the pylookup README.

(This also works for NumPy, SciPy, etc.)

I’ve been using Taesoo Kim’s pylookup for a while now to lookup Python documentation offline in Emacs. It’s a wonderful tool, especially combined with Emacs’ w3m browser, allowing Python programmers to lookup documentation without ever leaving the Emacs frame.

pylookup django

Here’s how to lookup offline Django documentation with pylookup:

I have pylookup installed through el-get, so it’s in ~/.emacs.d/el-get/pylookup. These instructions are modeled on Taesoo’s “Create Database” instructions in the Github README, but with a slight modification.

  1. Download and unzip the Django HTML documentation from https://www.djangoproject.com/m/docs/django-docs-dev-en.zip
  2. Move the resulting folder to the pylookup folder
  3. pylookup’s database creation expects a genindex-all.html file in the documentation folder. Let’s create that file by copying Django’s genindex.html:
    cp django-docs-dev-en/genindex.html django-docs-dev-en/genindex-all.html

  4. Add the Django documentation to pylookup’s documentation index (I already have the python standard library documentation indexed as per Taesoo’s instructions):
    ./pylookup.py -a -u django-docs-dev-en

    (Note the -a option that appends the newly indexed Django docs to the existing standard library docs rather than replacing them)

I can add more complete documentation for setting up pylookup if necessary, but between the Github README and this extra, you should be able to work it out.

Happy coding!

Advertisement
This entry was posted in Emacs, Python and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s