sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.56k stars 2.12k forks source link

Multiple lines in python signatures #3854

Open juanfcocontreras opened 7 years ago

juanfcocontreras commented 7 years ago

It seems that in version 1.5, there is support for multiple lines in functions signatures when using latex output, but only for c++ (#3180)

Is too complicated to add this support for python? When you have subpackages, this behavior happens quite often.

tk0miya commented 3 years ago

I'd like to know your proposal in detail. How is a function signature folded to multiple lines? between package name and function name? arguments?

arunanshub commented 2 years ago

I'd like to use this feature too.

I'd like to know your proposal in detail. How is a function signature folded to multiple lines? between package name and function name? arguments?

Each argument will be on its own line, similar to what Rustdoc does. For example:

module.inner.function(
    argument1: int,
    argument2: str,
    argument3: bool = False,
    *,
    kwonly_argument: str = "test",
) -> int

Furthermore, a threshold for splitting the arguments can also be implemented. Eg, if the number of arguments exceed 2, they will be split into their own line. Rustdoc does this too.