Issues

Issue #1558 open

Automatically enumerate public classes in a module/package

Laszlo Papp
created an issue

Currently, I am writing this explicitly, but it is hard coded and hence not good practice. It would be nice to have a way to automatically get the classes listed.

.. module:: mypackage

.. autoclass:: Foo :members:

.. autoclass:: Bar :members:

.. autoclass:: Baz :members:

Comments (11)

  1. Laszlo Papp reporter

    So that my package contains this init.py file:

    from mypackage.foo import Foo

    from mypackage.bar import Bar

    from mypackage.baz import Baz

    Could you please write down a simple example how automodule would work in that case?

  2. Laszlo Papp reporter

    Any advice? Is there a googlegroups free mailing list? I do not own an account that allows me to post there, unfortunately, and I would rather not do it if possible just for the sake of this.

    The aforementioned code did not work for me, sadly.

  3. Laszlo Papp reporter

    Just in case, this did not work:

    .. Test documentation master file, created by
       sphinx-quickstart on Wed Sep  3 11:42:18 2014.
       You can adapt this file completely to your liking, but it should at least
       contain the root `toctree` directive.
    
    Welcome to Test's documentation!
    ================================
    
    Contents:
    
    .. toctree::
       :maxdepth: 2
    
    .. automodule:: mypackage
       :members:
       :imported-members:
    
    
    Indices and tables
    ==================
    
    * :ref:`genindex`
    * :ref:`modindex`
    * :ref:`search`
    

    This did work:

    .. Test documentation master file, created by
       sphinx-quickstart on Wed Sep  3 11:42:18 2014.
       You can adapt this file completely to your liking, but it should at least
       contain the root `toctree` directive.
    
    Welcome to Test's documentation!
    ================================
    
    Contents:
    
    .. toctree::
       :maxdepth: 2
    
    
    .. module:: mypackage
    
    .. autoclass:: Foo
        :members:
    
    
    Indices and tables
    ==================
    
    * :ref:`genindex`
    * :ref:`modindex`
    * :ref:`search`
    
  4. Log in to comment