Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using numpydoc resulting in autosummary import error. #80

Closed
sirno opened this issue Dec 13, 2016 · 3 comments
Closed

using numpydoc resulting in autosummary import error. #80

sirno opened this issue Dec 13, 2016 · 3 comments
Milestone

Comments

@sirno
Copy link
Contributor

sirno commented Dec 13, 2016

When not explicitly declaring a method section in the class docstring numpydoc will create a autosummary table containing all public methods as an entry.
Also when only the methods names are contained in the section, i.e. method instead of method() numpydoc will also create an autosummary:

.. autosummary::

    method1
    method2
    <...>

This behaviour would be amazing, but it doesn't work unfortunately because autosummary will be unable to import the methods and thus create a table not containing any descriptions.
This may be an issue with autosummary, either on sphinx side or because the table is not generated properly. It may also be that the way I documented things is unintended. Anyways, here is a small example producing exactly the issue I am having. I'd be glad about any advice, thanks.

Minimal example:
example.zip

@rgommers
Copy link
Member

It may also be that the way I documented things is unintended.

I don't think it's unintended, but what you're doing does look different from what numpy, scipy & co are doing (which is to have a function listing per submodule, so then you'd be in the right currentmodule already probably.

Browsing your example, you do seem to need the Child subclass to demonstrate the problem. Your problem description above doesn't mention this only happening for subclasses. I have the feeling your problem summary is a bit too general.

@sirno
Copy link
Contributor Author

sirno commented Dec 27, 2016

Oh yes, indeed it is a bit general, sorry.

The problem only occurs when using .. autoclass:: and not when using .. automodule::. I didn't notice.

Also, I don't need the childclass to demonstrate the problem, it was just the way I produced the problem in the first place. When you remove the summary string (and the brackets) of aMethod in the methods section of Base, import will fail:

/example/docs/src/lib.classes/Base.rst:15: WARNING: failed to import aMethod

It does not fail before, because aMethod() (with brackets) can not be imported either way, so numpydoc generates a table directly from the docstring.

@rgommers rgommers added this to the v0.7.0 milestone Dec 27, 2016
@rgommers
Copy link
Member

gh-81 merged, so closing. Thanks @sirno

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants