Search code examples
pythonpython-sphinxrestructuredtextread-the-docsautodoc

Sphinx generates method arguments as bullet points instead of as a table


I have a problem when generating an api doc through sphinx using the karma theme. Currently, it generates method arguments and returns as bullet points instead of as a table.

On the left is our api doc, on the right is the karma-sphinx example:

On the left is our api doc, on the right is the karma-sphinx example

This is our conf.py

import os
import sys

sys.path.insert(0, os.path.abspath('./..'))

project = 'x'
copyright = 'x'
author = 'x'

release = 'alpha'

extensions = ['sphinx.ext.autodoc',
              'm2r2',
              'sphinx.ext.napoleon'
              ]

templates_path = ['_templates']

exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

html_theme = 'karma_sphinx_theme'

html_static_path = []

autodoc_mock_imports = ['sip', 'PyQt5', 'PyQt5.QtGui', 'PyQt5.QtCore', 'PyQt5.QtWidgets', 'digi',
                        'flask', 'baseconvert', 'numpy', 'dronekit', 'pyzmq', 'matplotlib', 'requests', 'future', 'flask_cors']

This is one of our module .rst

Frontend package
================

Subpackages
-----------

.. toctree::
   :maxdepth: 4

   Frontend.Components
   Frontend.Map


Frontend.MainWindow module
--------------------------

.. automodule:: Frontend.MainWindow
   :members:
   :undoc-members:
   :show-inheritance:

Frontend.MainWindowUI module
----------------------------

.. automodule:: Frontend.MainWindowUI
   :members:
   :undoc-members:
   :show-inheritance:

Module contents
---------------

.. automodule:: Frontend
   :members:
   :undoc-members:
   :show-inheritance:

Is there a setting to change it from bullets to a table or is this a bug? We have also tried the read the docs theme, with the same result. We use make html to build the pages without errors.

Edit: I tried to copy paste the karma example (rst + conf.py and built the html myself and got the same problem. Result when code copy pasted from the karma example Once again left is mine, the right is the example. I also had a friend build the html on his PC and of course on read-the-docs. But in all versions the problem persisted, so it should not be a problem with the sphinx / theme install.


Solution

  • It seems that karma-sphinx (and also insegel-sphinx for that matter) are not working well with the current versions of Sphinx.

    I got in working correctly (table instead of bullets) in Sphinx version 1.7.5, but it's broken from Sphinx 2.0 on (installed from pip).

    It's a shame, because I think karma-sphinx is quite pretty.