-
-
Notifications
You must be signed in to change notification settings - Fork 573
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
GenericMap now passes docstrings to its subclasses #5122
Conversation
Hello @asinghgaba! Thanks for updating this PR.
Comment last updated at 2021-04-28 19:33:35 UTC |
I think this is a change in behaviour, not a trivial fix, so I've milestoned for 3.0 instead of backporting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me - I'm happy to approve when @ayshih suggested change to the order has been made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the output from the PR is confusing (example for CORMap):
- The initial docstring of
GenericMap
("A Generic spatially-aware 2D data array") is not stripped out or otherwise prefaced. - The example in the docstring
GenericMap
is not stripped out, which means that every non-AIAMap
class shows an example of usingAIAMap
. (As an aside, why does the docstring forGenericMap
not showGenericMap
?)
This demonstrates that we can't do a simple string addition. There needs to be a deeper level of refactoring so that docstring elements can be re-used in the docstrings of both GenericMap
and the subclasses.
@ayshih I think this should be done by adding docstrings individually to each subclass. We could then strip as much we want according to the subclass. What do you think about doing it this way? |
I (mostly) disagree. We want the creation of the merged docstring to be under |
What do people think of adding some text along the lines of
instead? That way there's still a clear distinction between the docstrings of the two classes, but anyone using |
I wonder if we want to either do that or break up the important part of the Generic Map docstring and append that. Similar to how we do that with Fido Clients. |
e650155
to
2095e65
Compare
Rather than taking this approach why not do something similar to what we do in coordinates, where the parameters are templated into the docstrings? Splitting up docstrings on magic sequences feels prone to hard to detect issues to me. |
Final result: https://sunpy--5122.org.readthedocs.build/en/5122/api/sunpy.map.sources.AIAMap.html#aiamap There is a double notes section but I think the separation is important? |
I don't think the double notes section is an issue, but I am kinda surprised that sphinx doesn't get angry about that, I feel like old numpydoc would have done lol. |
Thanks for getting us started on this @asinghgaba! |
Description
Helps GenericMap to pass its docstring to its subclasses.
Fixes #3716