Read the Python documentation on your Kindle (or any other Sphinx-powered documentation)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This project lets you download a Kindle-optimized version of the Python documentation. You can also create your own ebook for any project using Sphinx to generate its documentation.

Download (Python 3.2.2, generated: 09/25/2011)

You can also clone the project with Git by running:

$ git clone git://

Kindle Python Documentation book

Generate your own ebook

You can also generate a Kindle-optimized file for any other version of Python.


The project must use Sphinx (this is the case for Python).

You also need to install Amazon's KindleGen tool and have it in your path:

$ ln -s ~/bin/kindlegen/kindlegen /usr/local/bin/

Step-by-step tutorial

I tweaked Sphinx a little bit (see modifications below) to make this possible.

$ cd ~/Downloads
$ hg clone
$ wget
$ tar xjf Python-3.2.2.tar.bz2
$ cd Python-3.2.2/Doc
$ echo -e "\n# to have the correct first page on Kindle\nepub_pre_files = [('index.html', 'Overview'),]" >>
$ python ~/Downloads/sphinx/ -a -b mobi . build/mobi

The MOBI ebook is ~/Downloads/Python-3.2.2/Doc/build/mobi/

Modified version of Sphinx

Context: the Kindle uses a proprietary format .azw. It is based on MOBI, another format designed by Mobipocket. This French company was acquired by in 2005.

I added a MOBI builder to Sphinx, based on the ePub one. Since there are scarce documentation about the MOBI format, I used KindleGen to convert the generated ePub to a MOBI ebook.

Here's what I changed to Sphinx:

  • Added guide section to content.opf (required by Amazon to set the first content shown and the TOC file)
  • Removed @font-face in the CSS (not supported by the MOBI format)
  • Used kindlegen to convert the ePub to MOBI.


Charles-Axel Dein –