sphinx-napoleon

Basic Syntax of comments and docstrings in Python code

自作多情 提交于 2020-07-09 12:04:57
问题 I'm learning how to use Sphinx to create a documentation for my code. After I saw some examples like this: def complex(real=0.0, imag=0.0): """Form a complex number. Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) """ if imag == 0.0 and real == 0.0: return complex_zero ... What is the language used in comments to make Sphinx understand and catch them? Without this syntax and logic, Sphinx doesn't see the comments in my code and when I generate

Basic Syntax of comments and docstrings in Python code

天涯浪子 提交于 2020-07-09 12:04:52
问题 I'm learning how to use Sphinx to create a documentation for my code. After I saw some examples like this: def complex(real=0.0, imag=0.0): """Form a complex number. Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) """ if imag == 0.0 and real == 0.0: return complex_zero ... What is the language used in comments to make Sphinx understand and catch them? Without this syntax and logic, Sphinx doesn't see the comments in my code and when I generate

How to automatically add parameter types in sphinx documentation

孤人 提交于 2020-01-23 05:42:05
问题 I am currently trying to implement automatic documentation creation with Sphinx (using the extensions sphinx-apidoc and napoleon). This works quite well, but it would be even better if the typehints (PEP484 convention) are added automatically to the params list. I was wondering whether this is possible. More concretely: (from the napoleon example) def function_with_pep484_type_annotations(param1: int, param2: str) -> bool: """Example function with PEP 484 type annotations. Args: param1: The