namedtuple autosummary complains about index() and count() methods

195 views
Skip to first unread message

Danylo Ulianych

unread,
Feb 22, 2020, 12:40:21 PM2/22/20
to sphinx-users


In `sparse/greedy_pursuit.py` source file:

```
Solution = namedtuple("Solution", ("x", "support", "residuals"))
```

The .rst file is

```
.. automodule:: sparse.greedy_pursuit
   :members:
```

`make html` warns

```
/home/dizcza/PycharmProjects/SparseRepresentation/sparse/greedy_pursuit.py:docstring of sparse.greedy_pursuit.Solution.rst:29: WARNING: autosummary: stub file not found 'sparse.greedy_pursuit.Solution.count'. Check your autosummary_generate setting.
/home/dizcza/PycharmProjects/SparseRepresentation/sparse/greedy_pursuit.py:docstring of sparse.greedy_pursuit.Solution.rst:29: WARNING: autosummary: stub file not found 'sparse.greedy_pursuit.Solution.index'. Check your autosummary_generate setting.
```

I don't have any `autosummary_generate` defined in `conf.py` which has been created by `sphinx-quickstart` default run. The only thing I modified is a list of extensions below.

**Environment info**
- OS: Ubuntu 18.04
- Python version: 3.7
- Sphinx version: 2.4.2
- Sphinx extensions:  
```
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.imgmath',
    'sphinx.ext.viewcode',
    'sphinx.ext.mathjax',
    'numpydoc',
]
```

Komiya Takeshi

unread,
Mar 1, 2020, 9:08:28 AM3/1/20
to sphinx...@googlegroups.com
Hi,

It seems your module sparse.greedy_pursuit expects to use autosummary
for documentation. So I guess you need to use autosummary instead of
autodoc. Could you ask the author of modules about a proper way to
generate documentation?

Thanks,
Takeshi KOMIYA

2020年2月23日(日) 2:40 Danylo Ulianych <diz...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/43d1c535-13eb-405d-baad-bdbf7edbfe7a%40googlegroups.com.

Danylo Ulianych

unread,
Mar 1, 2020, 4:29:11 PM3/1/20
to sphinx-users
Thank you for your reply.

I'm the author of sparse module https://github.com/dizcza/sparse-representation

After playing with autosummary I managed to understand what you mean and how to use it. Here is what I found

1. Setting `numpydoc_show_class_members = False` in the conf.py, as suggested in https://github.com/phn/pytpm/issues/3#issuecomment-12133978, with a combination of automodule+members (no autosummary) seems to work. But autosummary version is simpler to navigate and read.

2. Using autosummary option, I need to remove :members: key from my reference rst file and put the following lines in coherence.py

.. currentmodule:: sparse.coherence

.. autosummary::
:toctree: coherence/

mutual_coherence
babel

Then it worked. Thank you!
Maybe it'll help someone else as well.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx...@googlegroups.com.

Gregory Rose

unread,
Mar 1, 2020, 6:48:37 PM3/1/20
to sphinx...@googlegroups.com
Thank you for the opportunity to read the summary. Any input to help the greater cause would be an honor.


From: sphinx...@googlegroups.com <sphinx...@googlegroups.com> on behalf of Danylo Ulianych <diz...@gmail.com>
Sent: Sunday, March 1, 2020 3:29:11 PM
To: sphinx-users <sphinx...@googlegroups.com>
Subject: Re: [sphinx-users] namedtuple autosummary complains about index() and count() methods
 
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/8435c6cd-659a-4f50-a86f-d34fa5ac269c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages