X-Ref in Docstrings#11118
Conversation
|
Thanks! A lot of doc build warnings. You might want to build the docs locally and ensure warnings are all gone before pushing out more commits. Also tl;dr the original discussions: Does this solution depend on certain versions of Numpy? |
@saimn might know better. I'm looking at numpydoc, and it doesn't appear to depend on a specific numpy version. Presumably reference links to numpy objects depend on the numpy version, but more generally, I think not (?). |
|
Yes, I don't think there is a strong requirement on a given Numpy version. |
|
I don't think there should be such a huge list of terms in |
|
Example of a problematic docstring: astropy/astropy/modeling/core.py Lines 3560 to 3571 in d351a99 |
|
@mhvk @saimn Also, the description of Lastly, I haven't yet started combing the docs for places to swap in But it works! |
|
Edit: undid (see #11118 (comment)) |
|
Sure thing. I undid it.
I agree. For a different PR or this one?
👍 . Though only Also, I may be wrong, but I think |
|
Thanks for the great work on this @nstarman ! I missed that numpydoc has some default aliases (see below for the list, maybe add a link in our conf file ?), so that's great. |
mhvk
left a comment
There was a problem hiding this comment.
Love this initial step! I would not worry too much about making the description lengthy for Unit-like - my slightly revised text has a link to Unit that should do the trick.
On the warnings: is there a log where we can see where the errors occurred? It would obviously be good to reduce the number of terms ignored, but I feel whether we do it here or in follow-up depends a little on whether most come from a few older files that we can just tackle, or if it is really spread throughout the package.
Also, elsewhere there was a question about the impact on build time: does this make building the docs substantially slower?
👍
I'm attaching the log file from commenting out
I haven't noticed any slowdown. I haven't done a timed test... but it's doesn't feel slower. |
Good idea. I'll add a link
Haha. Definitely a possibility. |
|
I've made some progress, but there' still a lot of work remaining. I think the various package managers need to take a look to confirm the changed docstrings are correct. Also, I'm currently contending with some strange errors about not finding reference targets for things that should be there. |
1e919df to
854ec9a
Compare
|
@mhvk @saimn |
mhvk
left a comment
There was a problem hiding this comment.
Before anything else, this is fantastic. And clearly an amazing amount of work going through all bloody docstrings. Wow!!!
For now, I just looked at the implementation in conf.py and the glossary, etc., as well as units. See comments.
I do worry about how to proceed here, without getting into endless rebases, losing track of what has been reviewed and what not, while discussing possible changes to the terms, etc.
I guess it is difficult to go piecemeal because then some sections have errors? Is there any way to ignore errors in particular submodules, so that we can go step by step? (E.g., could we start with just astropy.units?)
Thanks!
I agree this will be a bit challenging. Unfortunately there is not a way to ignore errors in particular submodules. What we had before was a pile of ignores, but that had the problem that no one would get around to fixing them all if we committed just the stuff for |
|
Agreed with Marten, this is a really impressive work ! |
adrn
left a comment
There was a problem hiding this comment.
Some minor comments for nddata...
adrn
left a comment
There was a problem hiding this comment.
Minor comments for astropy.stats
Co-authored-by: Adrian Price-Whelan <adrianmpw@gmail.com> Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
|
I think this is ready! One last call for comments, but I suggest we merge today. |
|
@pllim is there a way to retrigger RTD? seems stuck. Edit: again. |
|
Re: RTD -- Unfortunately, not. Can't skip either. You just have to wait a bit and push again or close/re-open. |
|
As I said on #11590, most of the changes from #11590 are generated via this tool so can easily be reapplied on top of this pr which I partially did on nstarman#2; it spotted a number of typo/issues. I'm also working on https://github.com/Carreau/papyri to provide the same feature as sphinx when using terminal IPython or Jupyter. It seem to (mostly) work, see below gif, with a couple limitations: I thought it might be of interest to you to see how it looks like, as usually markup-heavy docstrings can be ugly in Jupyter, and I would be happy if you want to fill bugs there to tell me which sphinx features are missing in terminal rendering. |
dhomeier
left a comment
There was a problem hiding this comment.
Thanks, finally found the time to go over the changes in io.ascii; the one thing I am not sure about is the correct description of the Yields from DefaultSplitter.__call__; otherwise good to go!
@Carreau Those both seem like really cool tools! Many of us, and affiliate packages, and 🤞 astropy, use pre-commit. Velin seems well suited for that (if it can be run on diffs) as part of a good development workflow. Additionally / alternatively (@pllim), this might be useful in the daily or weekly cron jobs. |
|
Thanks @nstarman for your patience and determination here 😄 -- I think it's about time to merge this, and handle further changes in follow-ups. Any last minute comments here? Otherwise, I vote to merge! |
|
Hey, I'm going to press that lovely green button! Thank so much, @nstarman, for taking this on (and, even more impressively, sticking with it - 486 items in the conversation...) |

numpydoc x-ref allows for python, numpy, and custom-defined terms to be automatically cross-referenced and linked in RTD. It's what numpy uses for things like
array_likeand so that terms likeNoneandlistandstrnever need to be wrapped in backticks.For more info, see section
numpydoc_xref_param_typein https://numpydoc.readthedocs.io/en/latest/install.html,or #11063 for initial discussion.
Plan
numpydoc_xref_param_typenumpydoc_xref_ignore)numpydoc_xref_aliasesandglossary.rst)- [ ] squash commits.See #11555 for followups!
Subpackage review sign-off sheet
@adonath @adamginsburg @StuartLittlefair @astrojuanlu
@hamogu@dhomeier@saimn@matteobachetti@eslavich @tboch @tomdonaldson @perrygreenfield @mwcraig @taldcroft@adrn@mhvk@pllim @bsipocz @eteq @larrybradley @Cadair@astrofrog@mcara@ndenplease check and add your github handle after an approving review
Thanks @adrn for suggestion.