kalekundert / autoclasstoc

Sphinx plugin to make easier-to-navigate class documentation.
MIT License
18 stars 7 forks source link

How to not create inheritance containers? #5

Closed funkyfuture closed 4 years ago

funkyfuture commented 4 years ago

unfortunately one can't install editable packages from projects that solely have a pyproject.toml, so i can't hack my way through easily. hence my next question:

how could i let autoclasstoc not create the (html summary) nodes for inherited class members, but rather have all inherited members be listed equally in each and every subclass regardless where they are implemented?

afaict, one could control how these would be emitted as docutils nodes by overriding Section._make_inherited_details, but not neglect their segregation in the first place. overriding Section.format seems to be necessary, but imo there's too much going on there to override it in a future-proof manner. it seems simple though to use a new class property (sorry, "data attribute") that'd control whether inherited member end up separated.

kalekundert commented 4 years ago

Good catch, that's definitely something you should be able to do without having to overwrite format(), but right now that the only option. What's needed is a _find_attrs() method. Then you could overwrite _find_attrs() to return all attributes (i.e. inherited and non-inherited), and overwrite _find_inherited_attrs() to return {}. You wouldn't need to change _make_inherited_details(); it won't even be called if _find_inherited_attrs() doesn't return anything.

FYI, you can install a local editable version of the package using flit:

$ pip install flit
$ cd /path/to/autoclasstoc
$ flit install -s
funkyfuture commented 4 years ago

that is working well.