Sminx autmodule also documents imported modules

I am using sphinx to generate documentation for a package I am creating. The documentation is generated correctly, however it also generates the import documentation. Can an auto module be configured to only generate documentation for functions present in a specified module (and not in imported modules)?

EDIT

This only happens when doing the following import: from pylab import *

In the first file, I have:

.. automodule:: name.subname
   :members:

      

mzjn pointed out that this question has already been asked: Documenting files with "import x" and

The answer is to change the way pylab is imported:

import pylab
from pylab import *
for k,v in pylab.__dict__.iteritems():
    if hasattr(v,'__module__'):
        if v.__module__ is None:
            locals()[k].__module__ = 'pylab'

      

+3


source to share


1 answer


For modules __all__

will be followed when looking for members; the order of the members will also be the order of c __all__

.



__all__

is a good way for a module to declare what it really wants to be its public namespace. You can also put a comma separated list of items after :members:

in the Sphinx config, but is __all__

also useful for imports and other tools.

+2


source







All Articles