Skip to content

Add list of frame classes to main coordinates docs page - #9035

Merged
eteq merged 6 commits into
astropy:masterfrom
adrn:coordinates/organize-api-docs
Jul 25, 2019
Merged

eteq merged 6 commits into
astropy:masterfrom
adrn:coordinates/organize-api-docs

Conversation

@adrn

@adrn adrn commented Jul 22, 2019

Copy link
Copy Markdown
Member

This adds an auto-generated list of the built-in frame classes just before the full reference/API. I often want to see a text list of the frames, or need to click on the docs page for a frame class and scrolling through the full API is cumbersome.

@adrn
adrn requested review from eteq and mhvk July 22, 2019 21:03
@mhvk

mhvk commented Jul 22, 2019

Copy link
Copy Markdown
Contributor

Good idea! But I would suggest that we also move the lovely transform graph to this new section. This might actually be quite easy to do by adding the calculated _transform_graph_docs to builtin_frames.__doc__ rather than to coordinates.__doc__ (where it isn't that great, it makes coordinates? or help(coordinates) be useless).

@bsipocz bsipocz added this to the v2.0.15 milestone Jul 22, 2019
@adrn

adrn commented Jul 23, 2019

Copy link
Copy Markdown
Member Author

But I would suggest that we also move the lovely transform graph to this new section

Oh yea, good idea!


# Here, we override the module docstring so that sphinx renders the transform
# graph without the developer documentation in the main docstring above.
__doc__ = _transform_graph_docs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine as a work-around, though even nicer would be if somehow we can include it directly in the .rst file...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if that's possible with the current implementation, as it is generated on-the-fly. Maybe @eteq has some thoughts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked around a bit more and it does seem possible to let sphinx display just the docstring of an item: https://stackoverflow.com/questions/7825263/including-docstring-in-sphinx-documentation

But perhaps this is better done separately. cc also @astrofrog, who seems to know this kind of stuff.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's not the docstring of an item, it's a docstring generated by a function, right? Can we do this in a separate PR since this one works with the existing machinery?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in a separate PR may be best.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @adrn that the main problem is that it's generally difficult to do this kind of thing during the sphinx build process because it requires code execution. Options include:

  1. Doing it in the conf.py or a small custom sphinx extension
  2. Using an otherwise empty module called .../builtin_frames/transform_graph_docs.py that just does:
from astropy.coordinates.builtin_frames import frame_transform_graph
__doc__ = make_transform_graph_docs(frame_transform_graph)

and use .. module:: transform_graph_docs to import it. But I'm not sure that's really much better than the current solution.

Thiat said, I agree this is better dealt with separately.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually like the second solution! It helps to keep module __doc__ free for development stuff (which builtin_frames has already; see #8930)

@adrn
adrn force-pushed the coordinates/organize-api-docs branch from 7b79a83 to cd372d5 Compare July 24, 2019 01:05
@adrn

adrn commented Jul 24, 2019

Copy link
Copy Markdown
Member Author

Rebased, hopefully the html-docs build will work now?

@adrn

adrn commented Jul 24, 2019

Copy link
Copy Markdown
Member Author

Hmm - the failure is real, but I'm confused by it. Any ideas?

@pllim

pllim commented Jul 24, 2019

Copy link
Copy Markdown
Member

@adrn, I suspect your changes in index.rst caused inconsistency in the title levels. Try playing around with those and see if you can build it locally without warning first. See https://www.sphinx-doc.org/en/1.8/usage/restructuredtext/basics.html#sections

@adrn

adrn commented Jul 24, 2019

Copy link
Copy Markdown
Member Author

I suspect your changes in index.rst caused inconsistency in the title levels

Right, but I don't understand what could cause this - I just added a new title.

As I mentioned in Sphinx, my local build has 152 warnings (Sphinx 2.1.2, Python 3.7.3) so it's not the easiest to debug...

@pllim

pllim commented Jul 24, 2019

Copy link
Copy Markdown
Member

Hey, hey, seems like you fixed it!

@adrn

adrn commented Jul 24, 2019

Copy link
Copy Markdown
Member Author

Now just needs a review :)

@eteq eteq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too! Merging.

@eteq
eteq merged commit 5a791cf into astropy:master Jul 25, 2019
bsipocz pushed a commit that referenced this pull request Aug 1, 2019
Add list of frame classes to main coordinates docs page
bsipocz pushed a commit that referenced this pull request Aug 1, 2019
Add list of frame classes to main coordinates docs page
bsipocz pushed a commit that referenced this pull request Aug 1, 2019
Add list of frame classes to main coordinates docs page
@bsipocz

bsipocz commented Aug 2, 2019 •

Copy link
Copy Markdown
Member

This causes many docs warnings on LTS, so I'm inclined to not backport that far.

(See here: https://circleci.com/gh/astropy/astropy/39351)

@bsipocz bsipocz modified the milestones: v2.0.15, v3.2.2 Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants