3

I'm using Sphinx autodoc to generate the documentation for a python module from the docstrings in the source. I know I can include a :synopsis: in the automodule directive, but that kind of defeats the purpose of using autodoc, which is to put all of the documentation in the docstrings.

So I tried adding a module directive to the file like so:

.. module:: MyModule
    :platform: Unix, Windows
    :synopsis: A simple module to provide frobnication functions.

But then I get a "SEVERE" warning about duplicate modules, because I'm declaring it and autodoc is declaring it too. In addition, doing it this way also sort of defeats the purpose of using autodoc in that I have to specify the module name, instead of letting autodoc figure it out from the filename (not a big deal, but if I decide to change the name of the module, I need to change it here as well).

I was hoping I could use something similar to the moduleauthor directive for this, something like modulesynopsis or just synopsis alone as a directive, but Sphinx doesn't seem to recognize either of these.

Does anyone know if it's possible to include the synopsis in the docstring when using autodoc?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
brianmearns
  • 9,581
  • 10
  • 52
  • 79

0 Answers0