-
Notifications
You must be signed in to change notification settings - Fork 833
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
Move docs from __init__ to right after class defiition #2692
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.
All of my comments are towards the old docstrings, but I feel like it's the right opportunity to make those fixes! Otherwise LGTM!
@charlesbvll Thanks, good points. Let's make it consistent now. What do you think about removing the "default from the docs"? Re the links to the papers I think the best would be not to point directly to pdf but the arxiv.org/sth (there they can also see version etc). wdyt? |
@adam-narozniak Looking at our docs, it seems like Sphinx does not indicate the default value in all cases, which means that removing it from the docstring might remove some useful information from the docs. If we find a way to make it work consistently without using the docstring, I agree that it would be ideal. It's would be in another PR anyways. For the links, they're all pointing to the abstract instead of the pdf (except the one I pointed out), so it should be good! |
Ok, so I'm gonna fix the defaults in the docs, but then I think it'd be good to get rid of them. Sphinx shows the defaults in the parameters (in the function/class signature). What's the example that does not have that? |
Co-authored-by: Charles Beauville <charles@flower.dev>
It might be an issue with classes, here for instance the default for seed and shuffle are not shown (I took an example out of FDS because the goal is to migrate to the same tool). You can also see it on FedAvg or other strategies. |
Got it. I think that it's not an issue if that's not present in the "parameter doc" (for the lack of a better term).
so e.g. seed = 42
the split = None is present. So if we wanted the defaults in the "parameter docs" I would say it would be really worth it if there's some extension to do that. Because the cost of getting it wrong e.g. not changing manually when the change is in the code, outweighs the lack of having it in the parms docs because it's still in the signature/constructor. That's how I see it. The issue of default values visibility should be alleviated/less prominent when we have constructor/signature docs such that there's one parameter per line or the types are stripped from the constructor/signature. The current formatting makes it hard to read. That's one of the problems I see with the current docs. |
Issue
Some strategies have comprehensive docstrings in __ init__ but also short docstrings just after the class definition. That approach is not consistent with PEP 257 and it leads to documentation doubling.
Description
PEP 257 says that the class Docstrings should be (immediately following the class definition) - the most common option in our docs. The constructor (__init __) Docstrings is optional
Related PRs
#2644 describes the issue from the documentation POV.
Proposal
Move the docs from __ init__ to the right after the class def. This problem concerns Strategies (the rest of the code places the docstrings correctly).