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 not listing attributes #4534

Open
abchenson opened this issue Feb 1, 2018 · 7 comments
Open

autosummary not listing attributes #4534

abchenson opened this issue Feb 1, 2018 · 7 comments
Labels
extensions:autosummary type:enhancement enhance or introduce a new feature

Comments

@abchenson
Copy link

Subject: autosummary not listing attributes

Problem

  • On 1.6.6, when a class is included in an autosummary list witht the :toctree: option set, the generated page does not have an attribute list. Class, instance and property attributes are all missing despite being present if autoclass is used.

  • To me, it's a bug that autoclass and autosummary behave differently with respect to what items they document, and it's also a bug the the autosummary list of attributes is incomplete/missing. The lists of attributes shown by default should be the same, and complete. The solution to the bug would be that both directives show all documented attributes of all types, as autoclass currrently does (in particular, instance attributes should be included along with the others).

  • there's also the minor issue that instance variables get displayed with the default None in autoclass. There it can be overidden, if they do get included in autosummary, this would need ot be handled automatically

Procedure to reproduce the problem

A minimal sphinx setup (included below) can be used to reproduce this. The files provided in the gz are the conf.py file, an edited index.rst file invoking autosummary and autoclass, and a minimal example module containing a test class with class, instance and property attributes, test_mod.py. In this conf.py the only changes are that 'sphinx.ext.autosummary', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon' have been added to extension and autosummary_generate = true has been set. To reproduce run sphinx-quickstart, use the three files given here in the created directory, and run

PYTHONPATH=. make html

Error logs / results

the resulting autosummary and autoclass output:
image

The page generated by autosummary:
image

By changing the autosummary class template it's also possible to see that the autosummary template variable {{ attributes }} is an empty list.

Expected results

the last picture above should have an attributes list similar to the methods list including all the attributes listed in the autoclass output.

Reproducible project / your project

autosummary_bug.tar.gz

Environment info

  • OS: Linux
  • Python version: 3.5
  • Sphinx version: 1.6.6
    (NB: I think that on 1.4.8 autosummary used to show the class and property attributes but not the instance ones, which was also a bug if you agre with what I said above).
@abchenson
Copy link
Author

abchenson commented Feb 1, 2018

This similar to an old issue: #3257
But different in that (a) all attributes are missing and (b) it's pointed out that autoclass works fine but class pages generated by autosummary do not do the same thing
there also #4280 which is similar and has a suggestion for solving but has not seen any response

@tk0miya
Copy link
Member

tk0miya commented Feb 2, 2018

I guess #4247 resolved this issue. Could you try 1.70b2 please?

@abchenson
Copy link
Author

This is an improvement: class variables and properties are now showing up in the attributes list. But autoclass and autosummary are still showing different lists of attributes, and the list of attributes of autosummary is incomplete, because it misses out instance attributes which are included by autoclass. Might have something to do with what daphtdazz says the the answer here https://stackoverflow.com/questions/29902483/how-can-i-get-sphinx-autosummary-to-display-the-docs-for-an-instance-attributes

@tk0miya tk0miya added type:enhancement enhance or introduce a new feature and removed type:bug labels Feb 3, 2018
@tk0miya tk0miya modified the milestones: 1.7, 1.8 Feb 3, 2018
@tk0miya
Copy link
Member

tk0miya commented Feb 3, 2018

oh, sorry. I must study about autosumary... (I'm not good at it)

@abchenson
Copy link
Author

Thanks for your work on autosummary here and elsewhere! Do you have a time estimate for including instance attributes in the autosummary attributes similarly to autoclass? I might be able to submit a PR for this (or find someone to help!) if it is not going to interfere with what you are doing.

@tk0miya
Copy link
Member

tk0miya commented Feb 9, 2018

Unfortunately, I don't have time for it now. So PR is welcome!

@tk0miya tk0miya modified the milestones: 1.8.0, 2.0 Aug 19, 2018
@tk0miya tk0miya modified the milestones: 2.0.0, 2.1.0 Feb 5, 2019
@tk0miya tk0miya modified the milestones: 2.1.0, 2.2.0 Jun 2, 2019
@tk0miya tk0miya modified the milestones: 2.2.0, 2.3.0 Aug 18, 2019
@tk0miya tk0miya modified the milestones: 2.3.0, 2.4.0 Dec 8, 2019
@tk0miya tk0miya modified the milestones: 2.4.0, 3.0.0 Feb 7, 2020
@tk0miya tk0miya modified the milestones: 3.0.0, 3.1.0 Mar 14, 2020
@tk0miya tk0miya modified the milestones: 3.1.0, 3.2.0 May 23, 2020
@tk0miya tk0miya modified the milestones: 3.2.0, 3.3.0 Aug 2, 2020
@tk0miya tk0miya modified the milestones: 3.3.0, 3.4.0 Oct 27, 2020
@tk0miya tk0miya modified the milestones: 3.4.0, 3.5.0 Dec 19, 2020
@tk0miya tk0miya modified the milestones: 3.5.0, 4.0.0 Feb 14, 2021
@tk0miya tk0miya modified the milestones: 4.0.0, 4.1.0 Apr 11, 2021
@weinimo
Copy link

weinimo commented Jun 15, 2021

Hello, I ran into the same issue. Is there a chance that this is going to be fixed soon? Otherwise I will need to look for an alternative to autosummary.

Edit: I just found this PR that seems to fix this issue: #9146. If that's the case it should get referenced here.

@tk0miya tk0miya modified the milestones: 4.1.0, 4.2.0 Jul 10, 2021
@tk0miya tk0miya modified the milestones: 4.2.0, 4.3.0 Sep 12, 2021
@tk0miya tk0miya modified the milestones: 4.3.0, 4.4.0 Nov 8, 2021
@tk0miya tk0miya modified the milestones: 4.4.0, 4.5.0 Jan 15, 2022
@tk0miya tk0miya modified the milestones: 4.5.0, 5.0.0 Mar 27, 2022
@tk0miya tk0miya modified the milestones: 5.0.0, 5.x May 2, 2022
@AA-Turner AA-Turner modified the milestones: 5.x, some future version May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensions:autosummary type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

4 participants