-
Notifications
You must be signed in to change notification settings - Fork 349
Update discussion of parameter type specifications in docstrings #1757
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
Conversation
Thank you for contributing to PlasmaPy! The project's future depends deeply on contributors like you, so we deeply appreciate it! 🌱 The following checklist will be used by the code reviewer to help guide the code review process.
|
Codecov ReportBase: 98.33% // Head: 98.33% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #1757 +/- ##
=======================================
Coverage 98.33% 98.33%
=======================================
Files 95 95
Lines 8343 8343
=======================================
Hits 8204 8204
Misses 139 139 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
…aPy into docstring-guide-type-line
This reverts commit dbe6a1b.
It looks like there isn't a standard practice for multi-line type specifications: numpy/numpydoc#87 |
Oh, the LSST docstring guide has a section on docstring parameter types, with some examples pretty much from numpydoc. There are similarities and differences with matplotlib's conventions. |
A lot of my motivation for this PR is that the numpydoc standard doesn't cover a bunch of edge cases that come up for packages that depend on NumPy pretty often, but seemingly don't come up for NumPy itself. I am trying to be consistent with primarily the matplotlib style guide and also the LSST standards. The numpydoc standard would have been a much better place to clear up edge cases, but it seems pretty difficult to change since the PR I submitted on My main motivations for this PR are that standardizing the type specifications (ideally across projects) will:
|
@pheuer — might you be availble to review this? I was thinking you might have insight into parameter type description edge cases that are likely to come up in |
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.
To me, it looks okay. Having taken a look at your numpydoc PRs, the only worry I have is extending our docs too much beyond what the numpydoc standard currently offers. I don't want to break tooling that's based on a strict (as in, validated) interpretation of the standard.
But that's probably a worry for another day.
I also wonder how this plays with xarray, which I'd like to integrate in one day. Then you don't need to track the dimension number or ordering of your array because you're operating on named dimensions anyway.
But that's also a worry for another day.
Agreed. Going with matplotlib's style guide when possible partially addresses that worry, but not completely. At the moment our docstrings go beyond what's in the numpydoc standard in a bunch of places. For example, a lot of what's in
Interesting! I looked at xarray's contributor guide and didn't see much about docstrings.
That is absolutely my favorite type of worry! 😹 |
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.
All looks good - I think examples are really helpful for this but you've included a good number of them (and more are obviously in the code...)
|
||
.. todo:: | ||
|
||
Add a convention for multi-line type specifications. |
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.
This would be great...
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.
Agreed! I tried out some options, but have yet to find one that Sphinx renders as intended into the online documentation. Sigh!
This PR expands the discussion on type lines in docstrings, since it didn't have enough information before. I'm planning to base a lot of it on the matplotlib doc guide and on numpy/numpydoc#367. In particular, I want to add a bunch of type line examples, including for infrequent cases.