Questions tagged [autodoc]

Extension for the Sphinx documentation generator that imports Python modules in order to extract docstrings in a semi-automatic way.

Python Sphinx extension that can import the modules being documented, and pull in documentation from docstrings in a semi-automatic way.

The sphix.ext.autodoc extension can be used in conjunction with the sphinx.ext.napoleon extension. This allows use of NumPy and Google style docstrings. The Napoleon prepocessor will initially convert your docstrings to ReStructured text, that afterwards is processed by autodoc.

Several commonly used directives are provided by autodoc, namely ..automodule:: and ..autoclass: For examples of use see the sphinx.ext.autodoc documentation.

See also:

456 questions
0
votes
2 answers

autoattribute for parallel assignment of instance variables

When documenting instance variables, I can do class Foo: def __init__(self): self.spam = 4 """Docstring for instance attribute spam.""" This doesn't work for parallel assignment class Foo: def __init__(self): …
XrXr
  • 2,027
  • 1
  • 14
  • 20
0
votes
5 answers

Using sphinx for very basic structure

This is my file hierarchy: InfoRescue | |_ src | |_ _ _ includes | |_ _ _ _ _ i1.py |_ _ _ _ _ i2.py |_ _ _ _ _ init.py | |_ _ _ utils | |_ _ _ _ _ u1.py |_ _ _ _ _ u2.py |_ _ _ _ _ init.py | |_ _ _ doc | |_ _ _ _ _ index.rst |_ _ _ _ _…
Abhishek Gupta
  • 6,465
  • 10
  • 50
  • 82
-1
votes
1 answer

How to fix "Unexpected section title"?

This docstring: """ Returns ------- out: int Output. Bad title --------- Text. """ produces: C:\module.py:docstring of my_pkg.module.func:5: CRITICAL: Unexpected section title. Bad title --------- Can I make it respect Bad title, or at…
-1
votes
1 answer

Sphinx autodoc not using current docstring of method

When I run make html with sphinx autodoc enabled, the functions' docstrings are not the actual docstrings. I have the path configured in my conf.py file import os import sys sys.path.insert(0, os.path.abspath("../../")) # Where the module is…
Emir Sürmen
  • 884
  • 3
  • 14
  • 33
-1
votes
1 answer

How can I change `add_module_names` to `False` for specific modules?

How can I change add_module_names to False for specific modules? I have the following structure: src/ / _foo some_file.py / bar some_other_file.py I would like that all functions documents with .. autofunction:: from the _foo…
user3142
  • 799
  • 3
  • 9
  • 14
-1
votes
1 answer

How to indicate a return type that is nested (e.g. a list of ints)

I have a python function with nested return types, how can I indicate the return types correctly? (For example pycharm might detect the return type as Tuple[list, int, int] where every type is linked individually) e.g. def random_list(num): …
Mark Omo
  • 898
  • 2
  • 12
  • 26
1 2 3
30
31