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
Improve API documentation in CompositeBase #1968
Conversation
Improve the API documentation in CompositeBase. Correct the spelling of the NEGLIGIBLE_COORDS module attribute (keeping the old NEGLIBLE_COORDS in place for backward compatibility purposes). Mark check_areas as deprecated in the docstring.
Codecov Report
@@ Coverage Diff @@
## main #1968 +/- ##
==========================================
- Coverage 93.53% 93.51% -0.02%
==========================================
Files 279 279
Lines 41312 41309 -3
==========================================
- Hits 38642 38632 -10
- Misses 2670 2677 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
:func:`satpy.utils.unify_chunks`). | ||
|
||
Args: | ||
data_arrays (List[arrays]): Arrays to be checked |
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.
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 just tested locally. If I put the types only in the annotations, then the sphinx documentation reports the argument types in the signature, but not in the documentation body. The return type it documents in both locations. Maybe this is configurable, but if omitted in the docstring I think is not an improvement. Or would you put the information in both locations, duplicating it?
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.
There may be a sphinx extension we need to make it handle the arguments (I would hope it would come out of the box in the future). I'd prefer not duplicating.
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.
The logical place to put it is as type annotations of course, but sphinx not picking it up for the docstring is annoying of course. Can this help? https://github.com/tox-dev/sphinx-autodoc-typehints
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.
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.
Looking at xarray it looks like they tell "autodoc" to not include type hints and they have type annotations and docstring types in the source code. That's probably not what they want long term though and may just be a work around. Looks like they also have aliases for types/functions so they don't have to use long names in their docs when linking to things.
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.
So what is the conclusion here? Should I change this to have the type only in annotations?
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.
Leave it as-is for now. It isn't how I would do it, but that definitely doesn't make it correct. We'll have to look at this in some other PR as far as the sphinx docs handling it correctly. If you are bored feel free to try one or more of them out and see how it renders if you only include type annotations and nothing in the docstring.
I'll merge this if there are no more comments.
Remove the misspelt and hopefully externally unused NEGLIBLE_COORDS module attribute, and remove the check_areas method that had been deprecated for a while.
In the docstring of CompositeBase, point out that all modifier classes /also/ derive from CompositeBase.
Improve the API documentation in CompositeBase. Correct the spelling of
the NEGLIGIBLE_COORDS module attribute. Remove the spelling NEGLIBLE_COORDS.
Also remove the check_areas method, which had been deprecated for a while.