6

I am using Sphinx and autodoc for my Python package which results in nice documentation but by default the full "path" to the function, e.g.:

SomeFolder.AnotherFolder.MyModule.FunctionName(arg1, arg2, arg3)

Since it is clear where the module is, by how my sections are called, and since I get line breaks if there are long argument names, I would like to have a shorter name, like

MyModule.FunctionName(arg1, arg2, arg3)

I assume there is some option to pass to autofunction like

.. autofunction:: SomeFolder.AnotherFolder.MyModule.FunctionName
    :someoption:

but I couldn't find it on http://sphinx-doc.org/ext/autodoc.html

P.S: leaving out the folder names in the call of autofunction, i.e.,

.. autofunction:: MyModule.FunctionName

results in Sphinx not finding the function (and empty documentation)

mzjn
  • 48,958
  • 13
  • 128
  • 248
Leevi L
  • 1,538
  • 2
  • 13
  • 28
  • 2
    See http://stackoverflow.com/q/20864406/407651 – mzjn Aug 07 '15 at 14:41
  • Pretty close. The difference is that i want to keep module names but remove package names. – Leevi L Aug 10 '15 at 08:47
  • AFAIK, a package is just a module with a [`__path__`](https://docs.python.org/2/tutorial/modules.html#packages-in-multiple-directories) attribute. It might be possible to add some monkey patch that fiddles with `__path__`, but I don't have an actual solution. – mzjn Aug 10 '15 at 09:29

0 Answers0