Search code examples
pythonpython-sphinxepydoc

Moving from epydoc to sphinx to auto-document a simple python .py file


Epydoc is not working good anymore, even after applying patches, so I'm trying to move to Sphinx.

I want to auto-generate documentation from a simple python file: test.py

After installing and running sphinx-quickstart-script I copied test.py to the source folder and typed:

sphinx-build -b html .\source .\build

But it only produces the minimiun html files, and it does not parse the test.py file

I'm run out of ideas.

Thanks for your help :)


Solution

  • You have to include sphinx.ext.autodoc as an extension in your conf.py (https://www.sphinx-doc.org/en/master/usage/configuration.html), than you can document your module using the .. automodule:: directive (or objects from this module with .. autoclass::, .. autofunction::, ...).

    See https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html