Make sphinx autodoc show default values ​​in parameter description

I have the following docstring:

def progress_bar(progress, length=20): ''' Returns a textual progress bar. >>> progress_bar(0.6) '[##########--------]' :param progress: Number between 0 and 1 describes the progress. :type progress: float :param length: The length of the progress bar in chars. Default is 20. :type length: int :rtype: string ''' 

Is there any way to tell sphinx add the "Default is X" part to the parameter description, if available?

+7
source share
1 answer

This is not possible and must be done manually.

+2
source

All Articles