Sphinx + autodoc + apidoc

Dan Stromberg drsalists at gmail.com
Mon Oct 24 17:00:25 EDT 2016


Hi folks.

I'm attempting to set up Sphinx to document several API's based on docstrings.

I've got something browseable for one example API using Sphinx +
autodoc + apidoc.

However, we aren't really a PEP8 shop; we use hard tabs expanded to 4
columns, and we use 120 columns total width (and sometimes a little
more :).

I'd love to switch to spaces, but it's not my decision, so...  And
it's hard for me to imagine going back to 80 columns - it's so
confining, especially when you use good, descriptive identifiers.

Anyway, in the Sphinx pages that say "Source code for <modulename>",
and that show every line of the particular python module (syntax
highlighted), the tabs are all expanded to 8 columns, and the total
width is 80 columns.  I can scroll around to see everything, but it's
a little like looking at a football field through a microscope.

Is there any good way of making Sphinx use 4 column tabs and 120 column text?

I can imagine recursively applying *ix "expand -4" to the .py files to
get a for-doc-only tree before passing them to Sphinx, but what about
the 80 column limit?  And is there a nicer way of dealing with the tab
situation?

I googled quite a bit, and found some stuff suggesting that the Sphinx
devs would be OK with doing hard tabs, but Sphinx depends on Docutils,
and the Docutils project is perhaps more into PEP8.

Thanks!



More information about the Python-list mailing list