Publishing a Book with SphinxMon 08 April 2019 by Moshe Zadka
A while ago, I decided I wanted to self-publish a book on improving your Python skills. It was supposed to be short, sweet, and fairly inexpensive.
The journey was a success, but had some interesting twists along the way.
From the beginning, I knew what technology I wanted to write the book with: Sphinx. This was because I knew that I can use Sphinx to create something reasonable: I have previously ported my "Calculus 101" book to Sphinx, and I have written other small things in it. Sphinx uses ReStructuredText, which I am most familiar with.
I decided I wanted to publish as PDF (for self-printers or others who find it convenient), as browser-ready HTML directory, and as an ePub.
The tox environments I created are:
epub builds the ePub,
html builds the browser-ready HTML,
epub environment created a "singlehtml",
and I used Calibre command-line utility to transform it into an ePub.
This made for a prettier ePub than the one sphinx creates:
it had a much nicer cover,
which is what most book reading applications use as an icon.
However, that rendered poorly on Books.app (AKA iBooks).
One of the projects I still plan to tackle is how to improve the look of the rendered ePub, and add a custom cover image.
I have tried to use other sellers, but Gumroad was the one with the easiest store creation. In order to test my store, even before the book was ready, I created a simple "Python cheat-sheet" poster, and put it on my store.
I then asked friends to buy it, as well as trying to do it myself. After it all worked, I refunded all the test-run purchases, of course!
Refunding on Gumroad is a pleasant process, which means that if people buy the book, and are unhappy with it, I am happy to refund their money.
(Thanks to Glyph Lefkowitz for his feedback on an earlier draft. All mistakes that remain are my responsibility.)