autodoc

How to use Sphinx's autodoc to document a class's __init__(self) method?

How to use Sphinx's autodoc to document a class's __init__(self) method? Question: Sphinx doesn’t generate docs for __init__(self) by default. I have tried the following: .. automodule:: mymodule :members: and ..autoclass:: MyClass :members: In conf.py, setting the following only appends the __init__(self) docstring to the class docstring (the Sphinx autodoc documentation seems to agree that …

Total answers: 6

Connect Sphinx autodoc-skip-member to my function

Connect Sphinx autodoc-skip-member to my function Question: I want to use sphinx’s autodoc-skip-member event to select a portion of the members on a certain python class for documentation. But it isn’t clear from the sphinx docs, and I can’t find any examples that illustrate: where do I put the code to connect this? I see …

Total answers: 3

Python Sphinx autodoc and decorated members

Python Sphinx autodoc and decorated members Question: I am attempting to use Sphinx to document my Python class. I do so using autodoc: .. autoclass:: Bus :members: While it correctly fetches the docstrings for my methods, those that are decorated: @checkStale def open(self): “”” Some docs. “”” # Code with @checkStale being def checkStale(f): @wraps(f) …

Total answers: 8

Sphinx autodoc is not automatic enough

Automatically document all modules recursively with Sphinx autodoc Question: I’m trying to use Sphinx to document a 5,000+ line project in Python. It has about 7 base modules. As far as I know, In order to use autodoc I need to write code like this for each file in my project: .. automodule:: mods.set.tests :members: …

Total answers: 6

What is the correct way to document a **kwargs parameter?

What is the correct way to document a **kwargs parameter? Question: I’m using Sphinx and the autodoc extension to generate API documentation for my Python modules. Whilst I can see how to nicely document specific parameters, I cannot find an example of how to document a **kwargs parameter. Does anyone have a good example of …

Total answers: 8