I have a docstring in the beginning of every module describing its usage and functionality. Here I also want to add the most relevant parameters - like settings in a parameter file or via command line arguments. It's no classical function parameters since the module might be called as stand-alone as well (via if __name__ == '__main__'
capture). But since the ordinary parameter formatting of Sphinx is neat I want to just re-use it.
However, Sphinx seems to handle the "Parameter" section differently when in a module compared to when in a function.
This is how they are formatted differently:
Parameters in function docstring:
Parameters in module docstring:
You see the difference. In functions the keyword "Parameters" is added and then we have a nice bullet list. In modules no title is created, no list, the type is not set in braces but on an additional line etc.
Docstring format is the same (numpydoc):
Parameters
----------
pars : dict
Parameter dictionary.
key : str
Parameter name.
vs.
Parameters
----------
num_axial_segments : int
The number of axial rotor segments.
magnet_segmentation_method : int
The method of magnet segmentation.
0: Uniform segmentation (all magnets same amount of segments).
Does anyone have an idea why it's handled like this? And what I can do about it?
I would like the parameters in modules output in the same way as in functions.