sphinx
sphinx copied to clipboard
Autosummary support documenting inherited attributes
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
- 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
- If this approach is acceptable, I still need to write tests for this.
Relates
- Fixes https://github.com/sphinx-doc/sphinx/issues/9884
Mypy failures are caused by https://github.com/python/typeshed/pull/8064 being part of mypy 0.971 now released
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?
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 https://github.com/sphinx-doc/sphinx/issues/9884 Is there anything I can do to increase the change of this getting reviewed and eventually merged into master?
@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