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

autosummary broken on various packages #1891

Closed
larsoner opened this issue May 19, 2015 · 5 comments · Fixed by #1892
Closed

autosummary broken on various packages #1891

larsoner opened this issue May 19, 2015 · 5 comments · Fixed by #1892

Comments

@larsoner
Copy link
Contributor

We use RST code like the following in several places:

Visualization
=============

:py:mod:`mne.viz`:

.. automodule:: mne.viz
 :no-members:
 :no-inherited-members:

.. currentmodule:: mne.viz

Classes:

.. autosummary::
   :toctree: generated/
   :template: class.rst

   ClickableImage

Functions:

.. autosummary::
   :toctree: generated/
   :template: function.rst

   circular_layout
   mne_analyze_colormap

This used to produce nice docs, but on master and the version currently distributed with Anaconda, doc building completes but the areas above are now blank. I have bisected the problem to this commit:

21b8384

commit 21b838454f4bb5b6a246b85cb2f521deb7552505
Author: Luc Saffre <[email protected]>
Date:   Sat Jan 3 20:32:44 2015 +0200

    autodoc: use sourcename also for content generated by autodoc itself

    Fixes #1061
    Fixes #1656

Any idea what the problem could be?

@larsoner
Copy link
Contributor Author

I've isolated the problem to the addition of these two lines in sphinx/ext/autosummary/__init__.py:

            if not documenter.check_module():
                continue

Commenting out those lines fixes doc building for us. Now I'm going to investigate why the check_module is failing...

@larsoner
Copy link
Contributor Author

Oh, it's because a bunch of our classes and functions aren't defined in the specific module, so this check fails:

    def check_module(self):
        """Check if *self.object* is really defined in the module given by
        *self.modname*.
        """
        if self.options.imported_members:
            return True

        modname = self.get_attr(self.object, '__module__', None)
        if modname and modname != self.modname:
            return False
        return True

So it looks like if we can set options.imported_members = True, we should be good to go. Now to figure out how to set the imported-members option.

@larsoner
Copy link
Contributor Author

Ahh wait, I think this is actually a bug. Here is 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. Set the imported-members option if you want to prevent this behavior and document all available members. Note that attributes from imported modules will not be documented, because attribute documentation is discovered by parsing the source file of the current module.

But in our code, the members option is not set -- in fact no-members is set, because we want to manually specify our names. So I think the check above should only occur if members is set. I'll see if I can figure out how to query that option.

@jschueller
Copy link
Contributor

is it a duplicate of #1822 ?

@larsoner
Copy link
Contributor Author

Yep!

shimizukawa added a commit that referenced this issue Jul 5, 2015
FIX: Only check if members is True. closes #1822, refs #1891, #1828, #1061, #1663
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants