Sphinx autodoc including classes and methods

2.5k views Asked by At

I have python classes and some of them are in their own files

i.e. userdata.py:

class userdata:
    """User input class for reading..."""

    def __init__(self, fname):
        self.fname = fname        


    def trykey(self,name,injson):
....

I have tried multiple methods to be able to refer to a specific method in that class in the documentation, but it did not work.

I am generating autodoc via command

sphinx-apidoc 

It only generates modules for the code above

_lib.io package
=====================

Submodules
----------

.. toctree::

   lib.io.userdata

Module contents
---------------

.. automodule:: lib.io
    :members:
    :undoc-members:
    :show-inheritance:

Similar problem for modules with multiple classes i.e. ad1.py

class inner1(inherited)
....
class inner2(inherited)
....def
....

autodoc:

_lib.ad.ad1 module
===========================================

.. automodule:: lib.ad.ad1
    :members:
    :undoc-members:
    :show-inheritance:

Is there a way to get autoclass and automethod automatically generated as well.

0

There are 0 answers