-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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: Support documenting inherited attributes #10691
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
I have been using this for a while and other people in #9884 reports that this solves the issue for them too. Would it be possible to have this reviewed? |
@AA-Turner @takaakiaoki would it be possible to have this reviewed? |
45b63c4
to
edf247e
Compare
We have been using this to build our own docs since August and it solves a very real problem for me and for others, see comments in #9884 Is there anything I can do to increase the change of this getting reviewed and eventually merged into master? |
For inherited attributes qualname will not match the name of the actual obj that the attribute belongs to
Instance attirbutes on objects defined in other modules cannot be found by module analyzer unless we import that module. So try looking for instance attirbutes on objects in MRO order
With basic test that autosum can include inherited attributes
edf247e
to
b84b6e7
Compare
@AA-Turner @takaakiaoki could someone review this PR? Thanks! |
Wow, this PR has been sitting here for 3 months. Can this please be merged at some point? The bug is really annoying. |
Thank you @jenshnielsen! A |
For inherited attributes qualname will not match the name of the actual obj that the attribute belongs to
Subject: Autosummary don't filter attributes on qualname
Feature or Bugfix
Purpose
Allow autosummary to document inherited instance attributes.
The current implementation of import_ivar_by_name filters attributes if the name of the
object that the attribute belongs to does not match the object being documented. However,
for inherited attributes this is not the case. For my simple project here https://github.com/jenshnielsen/debugproject
simply not filtering on qualname but only on the attribute name seems to resolve the issue.
It is not clear to me if there are any unwanted sideeffects of this and we should filter on the list of
qualnames for the object and all its super classes (if any)
If the super class is defined in another module the above is not sufficient so, try looking
up instance attributes on modules in the MRO of the object
Detail
Relates