Installing Sphinx on Windows

Sphinx is an open-source tool for creating documentation. Written originally for the documentation of Python projects it also supports C/C++ with plans in the pipeline for support of other languages. Right now, my interest in Sphinx is that it is the tool used by readthedocs.org where I am planning to host the documentation for BrightstarDB.

BrightstarDB is a .NET application written in C# and I’m quite happy with the output of Sandcastle for the API documentation. However the developer and user docs were all originally created using the (commercial) Help & Manual application – which is a great documentation tool in its own right but would require contributors to the project to purchase a license in order to update or extend the docs.

Getting a local version of Sphinx running is the first step in evaluating if this approach is going to be feasible and as I’m developing on Windows 8, getting it running under Windows is my priority. So my goal here is to document how to install all you need to run Sphinx on Windows – with the qualifier that I’m doing this on Windows 8. YMMV on other Windows OSes.

  1. Install Python 2.7: At the time of writing Python 2.7.5 is the latest Python 2 release. The Python project has Windows installers available at http://www.python.org/download/. As my OS is 64-bit, I used the “Python 2.7.5 Windows X86-64 Installer”.
  2. Add the Python directory to your path: By default Python will install in C:\Python27 but will not add itself to your PATH environment variable. I find it useful to do that so I don’t have to keep typing the full path to the python.exe that you use to run Python scripts.
  3. Install setuptools: The current version is 0.6c11 and you can get it from https://pypi.python.org/pypi/setuptools Installation instructions for Windows are on that page and differ for 32-bit vs 64-bit OS. The basic procedure is to download easy_setup.py and then run it. If you updated the PATH environment variable as suggested above, then this is as simple as opening a new command prompt, cd to the directory you downloaded easy_setup.py to and typing:
    python ez_setup.py

    You will see output from the script as it downloads and installs setuptools into your Python directory.

  4. Add the Python scripts directory to your PATH: The core setuptools scripts get installed under {Python Directory}\Scripts and the Sphinx scripts will get installed in the same location so it is sensible to add this directory to your PATH environment variable. If you went for the default installation location you will add C:\Python27\Scripts to your PATH.
  5. Download the Sphinx egg: Eggs are Python packages that make it easier to distribute and install Python applications. The Sphinx egg can be found at https://pypi.python.org/pypi/Sphinx. At the time of writing the version is 1.2b1.
  6. Install the Sphinx egg: Open a new command prompt (to get your updated PATH) and cd to the directory you downloaded the .egg file to. You can then use setuptools to install the egg like this:
    easy_install Sphinx-1.2b1-py2.7.egg

    The package will install the Sphinx scripts and download and install a set of dependencies. The installation process produces a number of warning messages about not finding files but the installation runs through to completion OK.

  7. Try a Sphinx “Hello World”: The Sphinx project have a more thorough tutorial. But in a nutshell this is what to do (assuming you are still in the same command prompt window) – the following assumes you have your Python directory and Python Scripts directory included in your PATH environment variable.
    1. Initialise your project. The following command create and initialize a directory that will contain your documentation:
      mkdir MyFirstDoc
      cd MyFirstDoc
      sphinx-quickstart

      There now follows a list of questions. Apart from the project name, author and release number, the questions have default answers which for this quick runthrough you can just accept by pressing enter.

    2. Edit index.rst. The initialization process creates a starter file (by default it will be called index.rst). You will want to keep the toctree directive, but you can add more content before or after it. The reStructuredText Primer on the Sphinx project site guides you through the basic constructs that are pretty simple to get the hang of.
    3. Make the docs. The initialization process for Sphinx has helpfully added a make.bat file to your documentation directory so the only command you need to produce your documentation in HTML is:
      make html
    4. View your work: You should now be able to view the glorious generated HTML by typing:
      _build\html\index.html

And that’s all there is to it – should take you about 10 or 15 minutes from start to end. Of course, now the hardest part, I have to start writing the docs…

 

MovebleType to WordPress…How easy was that ?

Definitely an experience to file under the “it just works” category. Upgrading from my old old old installation of MoveableType to WordPress was almost totally painless. There were only a couple of small “gotchas” that I haven’t quite got around to fixing yet.

Firstly my collaborator on the Pepys topic map stuff, Stuart Brown has lost his credit on his posts. For some reason the importer decided that all posts has been written by Stu and I had a choice of either going through and manually editing each post by hand or just assigning them all to me. Always one to take the easy way out I opted for the latter. Sorry Stu! Still, if he is that upset, I can always let him come on over and do the manual editing, eh ?

Secondly the RSS feed will move so those of you who have a subscription will need to update your readers to look at the feed for posts or for comments (or both!) . I’ll see if I can force some sort of redirect through the magic of .htaccess, but hey what did I just say about always taking the easy way ?

The theme is “Love The Orange” for which my thanks go to the creators at Web Design Creatives.

I really like the editing interface in WP – spell checking and a nice WYSIAWYG HTML editor will mean I have fewer excuses for producing poorly written garbage. The whole admin interface is neat and intuitive and possibly my only gripe so far is that I can’t find a quick way to bulk edit more than the 15 posts you can display on a single page. And WP supports more ways to get a post up than my venerable MT isntallation did. Speaking of which, if anyone has any tips on good tools for posting to WP (from desktop and/or from a Symbian-based phone) please let me know in the comments section!

The plan…

In the four years since I last did anything with this blog, things have moved on a bit in terms of blogging systems, so I am considering replacing this MT installation with something a bit more hip, with it and down with the kids….well OK with WordPress anyways. As you can see from the page layout my design skills are somewhat poor but as a dedicated geek I hold fast to the belief that there is nothing that can’t be fixed by upgrading.
So all things being equal this weekend I’m going to try and get WordPress on to this site, and transfer all of my old posts over to it. My host has PHP and MySQL so I have the basic WP requirements, so hopefully it should be easy enough. If anyone has any tips or knows of any gotchas in moving from MT 2.6 to the latest WordPress please let me know.

Long time no blog

Yes its been a very long time since I last added anything to this blog. Nearly 4 years in fact! I’ve not been on a round-the-world tour or used the last four years to perfect my violin technique or been living in a closed community that uses only 19th century technology (aka Windows 3.1). Most of my time has been spent working on stuff at my company NetworkedPlanet. And running a startup, and keeping up wiht Topic maps and .NET (amongst other things) have basically taken over most of my time.
But now its time for a restart of my blogging career.
Roll on the next post (hopefully without the 4 year gap this time).

Visual cooking

Slashdot had an article on the site Cooking for Engineers which has recipes written for the analytical mind (as opposed to lists of recipes of flat foods).
What interested me was the presentation of the recipes. After the standard prose description, is a table of the ingredients and the method. Simple, but effective presentation. For example, check out this
recipe for tiramisu
– scroll to the end first and take a look at the table – it gets the whole process across incredibly easily.
Tufte for food addicts :-)

Thoughts from NotCon’04 – The Habits of Highly Prolific Geeks

NotCon’04 seems to have been a roaring success. I arrived early enough to get in (the venue quickly reached capacity and all day people were waiting on a one-out/one-in basis). Luminaries of the technorati including Cory Doctrow, Bill Thompson and Brewster Kahle were on hand and the twin foci of the day were web politics and inappropriate technology. I’ll be picking out a few of the most interesting bits of the day in a series of posts.
First up was Dan O’Brien’s presentation on the working habits of prolific geeks. In an interesting piece of research Dan emailed a questionaire to a selection of about 50 or so geeks known for their prolific output (including XML’s own Tim Bray). Some of the results were interesting and will probably ring true with many geeks.

Continue reading

RSSOwl

I’ve just downloaded and started playing with RSSOwl – a free RSS newsreader. Interesting to see a Java app written with SWT (other than Eclipse!) and nice to see that the download is “only” 3MB for the whole shooting match (including the SWT bits).

Doing it for chari-dee

I have just had an email from the webmaster of Charity-Ware.org an index of software for which the developer asks that money be donated to charity. Did you know that Vim is charity-ware ? Neither did I. Of course, that is part of the problem – and its nice to see an organisation trying to do something about it.
Of course, you don’t need to have software in return for giving money to charities like Shelter – just donate something! :-)