-
Notifications
You must be signed in to change notification settings - Fork 284
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
Adopt numpy docstrings #3840
Comments
To make it easier to have an opinion on this, could you shortly describe why the numpy style is better than the google style? |
BTW the current style, as described in https://scitools-iris.readthedocs.io/en/latest/developers_guide/documenting/docstrings.html , is not in fact simply "google style". I think we designed it to our own best needs. FWIW I personally prefer the more google-like style, simply because it uses less vertical space, which makes it more readable in the code files. |
See #3871. This PR enables the napolean extensions to allow both Google and Numpy docstrings. It does not force adoption of numpy - but it could with a change to the config in |
Personally, I think the Unless there is a hint of rigour or standardisation, which there isn't at the moment, we've ended up with quite a wide ranging combination of "google style" (and I use that in the loosest possible terms) doc-strings. After the documentation, users will hit the doc-strings to get details on functionality, and it's really is a bit of a lottery regarding the quality and format that they get. In general, I think it's high time that we had some doc-string hygiene, so it makes sense to me that if we're revisiting the content and quality of doc-strings, that we also address the format of the doc-strings. I think that we could argue either way for google style vs numpy style, but that fact that I can follow a numpy docstring guide, off the bat, wins hands down for me - there's a standard there to follow, and we don't have to reinvent the wheel, and it plugs into napolean just fine. So I'm 👍 for numpy style, which personally, I find a lot clearer and it renders just fine in readthedocs. So I'd happily iterate on slowing migrating |
Agree with all the above, except I marginally prefer google style for compactness, as I already said ! |
@SciTools/developers Are you guys happy for me to add this issue to the backlog for |
I have no objection to the proposal but I'm glad I'm not the one who would have to implement it! I must admit I've never gone looking for guidelines on how the docstrings should look. I just look at what else is in the module and try to make my new bit consistent. That approach would obviously be problematic if we are part way through porting... |
I may have overdone the enthusiasm slightly. |
That could potentially incorporate #3292, which is currently in the 3.1 milestone/project. |
If we agree to use numpy docstrings, we can review the default napolean settings: https://github.com/SciTools/iris/blob/master/docs/iris/src/conf.py#L135-L147 to ensure it fits our needs. We could also look into automating checks for non numpy docstrings so we can check for compliance over time. |
Although this all seems like a lot of work, if we just divvy it up between a whole bunch of core devs, and people iterate on individual modules so that we don't tread on each others toes, we could easily swarm on this and nail it pretty quickly. That would be lovely 😄 |
I rather assumed it already did that. |
hi @pp-mo, Napolean was introduced to also allow numpy docstrings, as some we being pulled in from outside of the Iris docs. This was enabled via https://github.com/SciTools/iris/blob/master/docs/iris/src/conf.py#L136. See the full PR #3871. A quick tests shows that if I set However, if any are badly formatted docstrings it will flag as a warning, and as all sphinx build warnings are now configured to be promoted to errors, it will fail the build (this is to ensure no warnings creep in). |
Let's close this issue and track progress of adoption via #4721 |
📚 Documentation
We should adopt the NumPy docstrings for Iris over the current Google Style docstrings.
There is a sphinx extension that allows both to be supported when creating the API documentation, named Napolean. This would allow the Iris codebase to gradually move to numpy docstrings and avoid a big bang approach.
We could also:
Can the @SciTools/iris-devs can agree this? (btw, I'm not proposing this goes into Iris 3.0.0)
The text was updated successfully, but these errors were encountered: