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
4
votes
2 answers

Sphinx does not show class instantiation arguments for generic classes (i.e. parametric types)

Sphinx HTML documentation for generic Python classes (i.e. parametric types) does not show the initialization arguments. Desired output: class GenericClass(value: T) Actual output: class GenericClass(*args, **kwargs) Python source code…
Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117
4
votes
1 answer

Bullet list style for single parameter functions in RTD theme using autodoc and Sphinx?

I've noticed that when I use autodoc with the ReadTheDoc theme, if I have multiple arguments in my functions they are listed in a bullet list style: arg1 arg2 ... but if there is only 1 argument then it is not using the bullet list style which is…
Goffer
  • 97
  • 1
  • 8
4
votes
1 answer

Sphinx with autodoc "duplicate object description" Warning when grouping members into separate files

I have some functions in a module which I would like to break up into two groups in my documentation. I have three files: my_mod.rst my_mod ====== .. automodule:: my_mod :no-members: .. toctree:: :maxdepth: 1 my_mod/group1 …
dshanahan
  • 676
  • 5
  • 12
4
votes
1 answer

How to create a horizontal line and white space between function signatures in Sphinx autodoc

I have found sphinx options for most of what I want to do, but I can't see how to inject white space and a horizontal line between function signatures when using autodoc. Here's what autodoc produces: get_all_edges(network=None,…
bdemchak
  • 263
  • 2
  • 10
4
votes
1 answer

FileNotFoundError: [Errno 2] when using sphinx and autodoc

I am trying to use sphinx to run an autodoc. My project structure like this: Where the python files are reading from input/input.xlsx. My conf.py looks like: import os import sys sys.path.insert(0, os.path.abspath('../../')) extensions =…
Adrian
  • 213
  • 4
  • 9
4
votes
1 answer

Sphinx autodoc can't find module

I am new to sphinx and need help to figure out why I am getting the following error: WARNING: autodoc: failed to import module 'employe_dao' from module 'models'; the following exception was raised: No module named 'models' My project structure…
Adam
  • 473
  • 5
  • 21
4
votes
0 answers

How to fix Sphinx "WARNING: invalid signature for automodule" error

I am currently working on documenting some code, and keep on getting the following warning/error (this is one example of multiple): WARNING: invalid signature for automodule ('components.component-1.orc_component_1.app) WARNING: don't know …
Biogitte
  • 303
  • 3
  • 9
4
votes
4 answers

Docstring inheritance for properties using sphinx's autodoc

I have a class like this: class MyBase(object): x = 3 """Documentation for property x""" and another class that inherits it: class MyObj(MyBase): x = 0 When I use sphinx's autodoc to generate documentation, MyObj.x is not documented. Is…
jterrace
  • 64,866
  • 22
  • 157
  • 202
4
votes
1 answer

How to document a single private attribute with Sphinx autodoc?

I'm using sphinx and the autodoc extension to automatically generate documentation from docstrings in my python modules. I currently using the automodule directive to document all the public members of the module .. automodule:: :members: My…
Brendan Abel
  • 35,343
  • 14
  • 88
  • 118
4
votes
0 answers

Sphinx toctree with automodule

I have modules I'd like to document such that the table of contents is on the main page index and the documentations themselves are in separate pages. I'm new to automatic documentation and Sphinx, but I've gotten…
Felix
  • 2,548
  • 19
  • 48
4
votes
2 answers

Sphinx- How to autodoc .py files located within multiple folders?

I am new to both Python and Sphinx and am attempting to autodoc python files located in a directory structured similar to the following: Project ├── Sphinx | ├── index.rst | ├── autodoc.rst | └── conf.py ├── Scripts | ├── file1.py | └── …
B. Evans
  • 121
  • 1
  • 5
4
votes
1 answer

How to generate sphinx docks in nested directory?

I want to generate sphinx autodoc documentation from scripts in nested folder structure : └── programs └── general_name └── another_folder ├── script1.py └── script2.py For some reason script1.py and script2.py…
Nir Vana
  • 387
  • 3
  • 9
4
votes
1 answer

I want to render a attribute of a class (which is a class) with my how doc

class Parameters(dict): """ Some doc here """ pass class System(object): Parameter = Parameters """ The default parameters attribute builder """ def __init__(self): self.parameters = self.Parameters() The problem…
user3240484
  • 209
  • 1
  • 4
4
votes
1 answer

Documenting Python coroutines with Sphinx autodoc

I'm starting to document my first asyncio-based project with Sphinx. I noticed some projects have this "coroutine" prefix before some methods and I'd like to do the same in my project's documentation, but I can't figure out how. For example,…
André Caron
  • 44,541
  • 12
  • 67
  • 125
4
votes
3 answers

How to use Python 3.5 syntax in readthedocs combined with autodoc?

I would like to generate documentation (including automatically generated documentation with autodoc) for my project using readthedocs.org. However, my project uses Python 3.5 syntax (async and await) and it doesn't look like it can handle that. The…