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.
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
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/
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
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.
Charles-Axel Dein – www.d3in.org