Documenting Files With "from X Import *"
Solution 1:
Yes, that should work. From the documentation:
In an automodule directive with the members option set, only module members whose
__module__
attribute is equal to the module name as given to automodule will be documented. This is to prevent documentation of imported classes or functions.
Update:
The problem seems to be that the __module__
attribute of many pylab
members is None
(the members defined in the C/Cython module mtrand
, as far as I can tell).
The mtrand
module is part of NumPy. Behind the scenes, pylab.beta
(and several other functions) is a method of the class numpy.random.mtrand.RandomState
. I can reproduce the documentation issue as follows:
With this source (pylabtest.py)
from pylab import beta
defmzjn(x):
"""mzjn docstring"""return x
and this source documentation (pylabtest.rst)
Pylab test
==========
.. automodule:: pylabtest
:members:
the Sphinx output in pylabtest.html includes both beta
and mzjn
.
But if
beta.__module__ = "pylab"
is added to pylabtest.py, only mzjn
is documented.
Post a Comment for "Documenting Files With "from X Import *""