Purrell
Purrell

Reputation: 12881

Documenting module/class/function bodies in Python Sphinx docs

Is there a way with Sphinx documentation to output a function or class body (the code itself) with the autodoc feature? I'm using autodoc to much success. In addition to the docstrings getting pulled in to the documentation I want like a link to click for each function where it will show you the source... is that possible?

This is about what most of my documentation looks like now:

.. module:`foo.mymodule`

Title
===================


.. automodule:: foo.mymodule

.. autoclass:: MyModulesClass
    :members:
    :undoc-members:

Upvotes: 1

Views: 856

Answers (2)

Florian Diesch
Florian Diesch

Reputation: 1025

If this still matters: The viewcode extension can do this, but needs the development version (1.0) of Sphinx

Upvotes: 2

Patrick Altman
Patrick Altman

Reputation: 900

I don't believe so. Autodoc is only for pulling the documentation out of the source code.

Upvotes: 1

Related Questions