Skip to content

Show inherited class methods by default in documentation? #4978

Open

Description

@mhvk

In #4123, I split out Time's shape-changing methods to a new mixin class. It turned out that by doing that, these methods no longer automatically appear in the documentation. Rather, I had to add an :inherited-members: option to the time automodapi line: c9c4abf

For the same reason, the documentation for Quantity shows none of the methods inherited from ndarray and in the new solar_system_ephemeris science state class, I cannot link to its set method inherited from ScienceState.

Given this, I wondered whether we shouldn't simply include inherited members by default. Is there any strong reason not to?

Activity

  1. eteq commented on May 26, 2016

    @eteq
    Member

    As I recall, we tried this a while back, and the biggest problem is that it ends up showing a lot of "junk" - e.g. lots of methods that are not particularly relevant for most use cases and therefore distracting to the user. For example, we do not want Angle to show all the Quantity and ndarray methods because it's impossible to tell which are the new bits Angle adds, and that's really what the API page for Angle is focused on. Similarly, lots of the ndarray methods are not particularly important for understanding how to use Quantity.

    So with that in mind, I think it's a feature, not a bug, that you have to explicitly do :inherited-members: - that way you can opt-in when relevant, but only when there's a specific reason to do so.

  2. eteq commented on May 26, 2016

    @eteq
    Member

    (But maybe :inherited-members: has become smarter about what it shows since then? Might be useful just to see a before-and-after of what the docs look like with it turned on or off...)

  3. mhvk commented on May 26, 2016

    @mhvk
    ContributorAuthor

    Ah, I see the problem for Angle... Though for Quantity, the case is less clear, since we override about half the methods of ndarray, which are shown, but not those that just happen to do exactly what we want anyway...

    Also, while for Time, I could just turn inheritance on, I'm slightly stuck for Coordinates, since I would want to show the reshape etc. methods for SkyCoord (wouldn't I?) or the ScienceState methods in solar_system_ephemeris, but not the Quantity methods in Angle.

    Maybe a solution is that at the end of each "methods summary/attribute summary", by default also a list of methods inherited from the base classes is listed, each clickable. I'll see whether this might be relatively easy to add...

  4. eteq commented on May 26, 2016

    @eteq
    Member

    👍 to the "clickable" list at the end - might be really tough to implement that cleanly, but it would work great if possible...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions