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.
Permalink
Failed to load latest commit information.
Python.epub
Python.mobi
README.md

README.md

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.mobi (Python 3.2.2, generated: 09/25/2011)

You can also clone the project with Git by running:

$ git clone git://github.com/charlax/Python-Documentation-Kindle

Kindle Python Documentation book

Generate your own ebook

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

Requirements

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 https://bitbucket.org/charlax/sphinx
$ wget http://www.python.org/ftp/python/3.2.2/Python-3.2.2.tar.bz2
$ 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'),]" >> conf.py
$ python ~/Downloads/sphinx/sphinx-build.py -a -b mobi . build/mobi

The MOBI ebook is ~/Downloads/Python-3.2.2/Doc/build/mobi/Python.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 Amazon.com 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.

Author

Charles-Axel Dein – www.d3in.org