-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MAINT: Move docstring of LogLocator
to class
#22700
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
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
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 constructor parameters should be kept in __init__
's docstring (which can be accessed just as well via Foo.__init__.__doc__
or similar); see #17029 for rationale. (Probably this should be noted somewhere in the style guide.)
@anntzer The NumpyDoc style guide states, that the This is in accordance with the ecosystem, e.g., using Personally, I want to know the constructor ( Duplicating the documentation in |
I don't really want to fight over this (even though I think documenting in |
I don't really care, either. But like I said, the NumpyDoc style says put it in the class docstring. Editors act accordingly. So if See the attached screenshots, the current situation is really annoying:
That's so annoying that I opened the pull request. P.S.: https://github.com/python-lsp/python-lsp-server was used. If there are other language servers that handle numpydoc differently, please correct me. |
https://matplotlib.org/3.2.0/api/table_api.html#matplotlib.table.Cell is the "wrong" rendering (with doubled parameters docs). I'm not going to block this PR, just pointing out that we should try to avoid this kind of problems... |
You are blocking this PR 😉 I agree that we can't have mis-rendered docs, I just wasn't clear if we had mis-rendered docs because of a sphinx bug, or us needing to do the docstring inheritance differently. |
It's doubled because we have configured Sphinx to display both class and |
I'd propose we merge this. Suggest its a bunch of easy first contributions to clean up putting the docstrings in the class def.... |
As there was some controversy here, we might consider adding some info to the documentation guidelines. In principle, numpydoc is referred
so it should be fine. But if there is confusion, being explicit might be better, even if it is redundant. |
I don't know if there is confusion per-se, just that our codebase developed somewhat before numpydoc even existed. |
This needs a rebase now. |
Note that the numpydoc standard (document
So we might theoretically break other tools. TL;DR Overall I'm +0.1 for class-docstring only Should tools be able to cope with/wo
|
I've added this to the call.... |
@jklymak don't suppose you remember if a decision was reached or documented here? |
@dstansby No I don't recall what was decided, if anything. |
Doc string is not accessible to some IDE tools if it is placed on `__init__` instead of on class.
I propose we merge this and open a new issue to document (and enforce uniformly) where this should go. |
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.
👍 - thanks a lot @DerWeh for this contribution, and really sorry it got bogged down in a long conversation before being merged.
Doc string is not accessible as it is placed in
__init__
instead of class.PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).