Repository navigation
Conversation
|
I think the failure is just a fluke - It seems I can't restart it myself, so could someone restart that build? |
|
I wonder if this is something that can (or should) be addressed upstream, e.g. in astropy_helpers.sphinx.ext.numpydoc.py. So that directives have more freedom where they are located. |
|
@evertrol Dynamically altered docstrings should be pretty rare and if one writes it by hand then one can put it where it (should) belong. Also I wouldn't like sphinx/numpydoc to move parts of the docstring around. That makes it somewhat non-deterministic. The only thing I really miss in numpydoc is a |
|
"then one can put it where it (should) belong.". I tried adding a As for a |
|
@evertrol You have to be careful about indentation when you add directives in parameters but it works. See for example I'm not sure if it exactly works like this but in general this worked for me:
|
Thanks, that was the part I forgot. Probably because I was more focused on a general or section directive, not one related to a single parameter. (But it now has me wondering if the |
You mean removing the part that dynamically creates the docstring and just insert the directive manually? |
More generally where such a note should be put: the NDData examples put an That may be done automatically (which requires some parsing of the docstring to infer the indentation level and change), or it may be done manually (which is essentially just an extra line similar to adding the @-decorator line, and a switch to turn off the dynamic update of the docstring). My current preference would be next to the parameter and manually added, but perhaps there are good reasons not to (other than some repetition). |
I actually like that idea. It's a bit of repetition and it will likely be forgotten in some future cases but it's a) not removed from the docstring as soon as the decorator is removed and b) simplifies the decorator a lot. I'll wait for others to chime in before I change anything though. |
|
I would also prefer to have it next to the relevant parameters. |
|
ok, I'll remove the dynamic adding of the directives, then #5171 or a follow-up PR needs to add the directives manually. |
|
Merging. |
|
@pllim Thank you! |
|
Linking to #5214 for future reference. |
It was mentioned in #5171 (comment) that appending the sphinx directives might not be the best way if one wants correctly rendered docstrings.
This PR includes the directives at the first empty line of the stripped and normalized docstring.