-
Notifications
You must be signed in to change notification settings - Fork 427
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
Doc fixes #365
Conversation
Haha yes Sphinx/reST syntax really is horrible. I think the bullets just aren't supported in Google-style docstrings. This works (NumPy-style):
Btw I found this which I think would be nice for tensors: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#confval-napoleon_type_aliases |
@@ -176,8 +176,8 @@ def bound_complex_mask(mask: ComplexTensor, bound_type="tanh"): | |||
"tanh"/"bdt" (default), "sigmoid"/"bdss" or None/"bdt". | |||
|
|||
References |
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.
Do you know why we have :
at the end of Args:
but not for References
?
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.
docs/README.md
Outdated
### Writing good docstrings | ||
|
||
- Start with [RST and Sphinx CheatSheet](https://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html) | ||
- Linking to method in a class `:func:~mymodule.myclass.myfunc`. |
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.
That would be :meth:
actually, see here https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects (you can omit the :py:
)
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.
But I think you can use any tag (role) and it works anyways
Btw what's that |
Co-authored-by: Jonas Haag <jonas@lophus.org>
Thanks a lot for your feedback !
No idea, but it works ✨ 😂 |
What's your call on the multiple output function then? |
I really don't know. Here's what the internet says... https://stackoverflow.com/questions/29221551/can-sphinx-napoleon-document-function-returning-multiple-arguments So looks like Google style just doesn't support this, and we should be using the "tuple of N elements:" workaround instead. I guess the best way to implement it would be using lists (like in your example 2) but not sure how much work it is to get this into Sphinx. Also found this, not sure if related sphinx-contrib/napoleon#4 |
I tried By the way, do you know how to automatically have anchor points for each class/function that is documented? |
No sorry :( My best advice is to look at other documentations and try to copy their config :-D
This is nice, if this works out ok I think it would be great to add this to Stack Overflow |
Trying to fix the docstrings to render nicely on 0.4.0 release.
I'm struggling with functions that return multiple things, the docstring is never parsed right when it starts by the return type.
Comparing docstrings and visual