## Using sphinx with cython files

With the currently released version of sphinx (1.1.3), it is unfortunately not possible to document cython files due to a bug (see here). On that page is a monkeypatch provided (btw., on this occasion I learned about monkeypatching). However, it turned out to be a lot easier to just install the development version of Sphinx 1.2 and have the issues disappear automatically.

A version egg is available from pypi, directly for download here. Installation is as easy as doing

 1 2 python setup.py build sudo python setup.py install 

and the cython-module doc can be generated.

Just make sure you have the .pyd compiled module ready, and have at the very top of the cython file the directive # cython: embedsignature=True included.

Edit: If you want sphinx-apidoc to include .pyx files, simply apply the tip I found here:

Navigate to your sphinx folder (/path/to/site-packages/Sphinx-1.2predev_20121210-py2.7.egg/sphinx) and edit apidoc.py at line 165 from

 1  py_files = sorted([f for f in files if path.splitext(f)[1] == '.py']) 

to

 1  py_files = sorted([f for f in files if path.splitext(f)[1] in ['.py','.pyx']])