Skip to content

DOC: Get rid of sphinx-gallery and move coordinates examples - #17270

Merged
mhvk merged 10 commits into
astropy:mainfrom
pllim:exorcise-sphinx-gallery
Feb 4, 2025
Merged

mhvk merged 10 commits into
astropy:mainfrom
pllim:exorcise-sphinx-gallery

Conversation

@pllim

@pllim pllim commented Oct 28, 2024 •

Copy link
Copy Markdown
Member

Description

This pull request is to finally move away from sphinx-gallery and get rid of the Example Gallery that never really lived up to its full potential. One less dependency to worry about.

Also see #16194

TODO

  • Actually move the contents over. Need some reformatting.
  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@pllim
pllim force-pushed the exorcise-sphinx-gallery branch 2 times, most recently from cbca789 to 053e81b Compare October 29, 2024 20:07
@pllim

This comment was marked as resolved.

@pllim
pllim force-pushed the exorcise-sphinx-gallery branch from cafe6f3 to 9500d26 Compare October 30, 2024 01:10
@pllim

This comment was marked as resolved.

@neutrinoceros

Copy link
Copy Markdown
Contributor

But only on OSX... eye twitches

This seems reminiscent of similar issues we've had with how numpy and scipy's bundled c++ libraries cannot guarantee portability at the ulp level. Isn't this what pytest-doctestplus can help us with ?

@pllim
pllim force-pushed the exorcise-sphinx-gallery branch from 9500d26 to 5cdcec8 Compare October 30, 2024 15:00
Comment thread docs/coordinates/example_gallery.rst Resolved
@pllim pllim modified the milestone: v7.1.0 Oct 30, 2024
@pllim
pllim force-pushed the exorcise-sphinx-gallery branch from d7bf0df to d7af9f9 Compare October 30, 2024 17:33
@eerovaher

Copy link
Copy Markdown
Member

If the biggest problem with the Example Gallery is code rot then how is just moving things from there to the main narrative documentation supposed to help with that?

@pllim

pllim commented Oct 30, 2024

Copy link
Copy Markdown
Member Author

how is just moving things from there to the main narrative documentation supposed to help with that?

As you might have noticed, they are run in doctest now.

@eerovaher

Copy link
Copy Markdown
Member

Why can't we simply include the example gallery in the doctests?

@pllim

pllim commented Oct 30, 2024

Copy link
Copy Markdown
Member Author

There was already plenty of discussion on the example gallery. We wanted to get rid of it.

@eerovaher

Copy link
Copy Markdown
Member

But you are not getting rid of it, you are just moving it around.

@pllim

pllim commented Oct 30, 2024

Copy link
Copy Markdown
Member Author

I mean, getting rid of the sphinx-gallery stuff. No one can agreed on where to move it to, so I just made a decision to put them in new page under coordinates docs. If you have ideas, please share. Thanks!

@pllim

pllim commented Oct 30, 2024

Copy link
Copy Markdown
Member Author

If you think these examples are duplicate of certain sections already, we can absorb them into those sections too. There are too much materials under coordinates docs and I don't feel like reading all of them.

@pllim
pllim marked this pull request as ready for review October 30, 2024 20:39
@pllim pllim added the Extra CI Run cron CI as part of PR label Oct 30, 2024
@pllim
pllim requested review from adrn, eerovaher, kelle and mhvk October 30, 2024 20:41
@pllim
pllim force-pushed the exorcise-sphinx-gallery branch from beeddcf to b78fb68 Compare October 31, 2024 18:18

@cmarmo cmarmo 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.

Thanks! Everything good for me.

curve:

>>> fig, axes = plt.subplots(1, 2, figsize=(12, 6))
>>> _ = axes[0].plot(gc_rings.x.T, gc_rings.y.T, marker="None", linewidth=3)

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.

Why are all these underscores needed? As a reader I find them distracting.

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.

doctest complains about output otherwise because they return objects. In notebook, you could add ; to suppress that but I am not sure about >>>. I find having to add so many # doctest: +IGNORE_OUTPUT tedious but that is another option. Other ideas welcome.

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.

This is user-facing documentation. The closer the examples are to what the users should write themselves the better. The # doctest: +IGNORE_OUTPUT instructions are not rendered in the HTML documentation, so they are a much better solution than the leading underscores.

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.

Yes, makes sense, I guess laziness is no excuse... 😆

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.

Done!

@adrn adrn 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.

I still believe in the idea of the sphinx-gallery and think it can be used effectively (see, e.g., scikit-learn's example gallery). Is the main argument to remove it that "the examples haven't been updated in a while" or is it still causing issues for the docs build? An alternative could be to solicit new maintainers or effort into maintaining the existing gallery.

@eerovaher

Copy link
Copy Markdown
Member

I am confused about why we would want to have these examples in astropy documentation when we have a dedicated repository for tutorials.

@pllim
pllim force-pushed the exorcise-sphinx-gallery branch from b78fb68 to 6b02d93 Compare November 4, 2024 21:41
@pllim

pllim commented Nov 4, 2024

Copy link
Copy Markdown
Member Author

@adrn , I agree that a gallery is very useful for visualization driven library and analysis like matplotlib and scikit-learn . But astropy is a collection of many sub-packages, most not visually driven. In the 10+ years of this gallery existing here, it only had a few examples from FITS and coordinates (https://docs.astropy.org/en/v5.3.4/generated/examples/). These examples are not doctest-ed (not to be confused with rendered) and sit forgotten in a corner of the source dir. As Eero pointed out, Learn Astropy is a better place to illustrated a many capabilities of astropy . This gallery just never really took off and cause maintenance headache from time to time (and some complains about accessing remote data in a surprising way). I think in this case, the cost outweighs the benefit.

@pllim

pllim commented Feb 3, 2025

Copy link
Copy Markdown
Member Author

So, can I go ahead with this? If so, I will rebase. Otherwise, I don't want to waste time keeping it updated. Please advise. Thanks!

@mhvk

mhvk commented Feb 3, 2025 •

Copy link
Copy Markdown
Contributor

FWIW, I agree with tossing the gallery.

EDIT: especially since we're not actually losing any examples, just the way they are generated. Sphinx is annoying enough on its own!

pllim and others added 10 commits February 3, 2025 18:37
WIP: Still need to copy over the contents. [ci skip]
Update pyproject to handle deps

Revert nice print as suggested by astrofrog
Co-authored-by: Chiara Marmo <[email protected]>
Co-authored-by: Marten van Kerkwijk <[email protected]>
Co-authored-by: Adrian Price-Whelan <[email protected]>
Co-authored-by: Erik Tollerud <[email protected]>
because it is set globally in conftest.py so not sure why that did not get pick up locally
as suggested by eerovaher
@pllim
pllim force-pushed the exorcise-sphinx-gallery branch from 6b02d93 to cc4b63f Compare February 3, 2025 23:37
@pllim

pllim commented Feb 4, 2025

Copy link
Copy Markdown
Member Author

Exotic archs and linkcheck failures are unrelated.

@pllim

pllim commented Feb 4, 2025

Copy link
Copy Markdown
Member Author

@mhvk , thanks for your inputs! I have rebased it. Are you willing to do a final review? 🙏 🙇‍♀️

@mhvk mhvk left a comment

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.

Looks all good to me!

@mhvk
mhvk merged commit 6663df9 into astropy:main Feb 4, 2025
@pllim
pllim deleted the exorcise-sphinx-gallery branch February 4, 2025 17:15
timhoffm added a commit to timhoffm/sphinx-gallery that referenced this pull request Dec 15, 2025
- removed astropy (see astropy/astropy#17270)
- updated some project URLs
- linked to the gallery (or one of them) instead of the top-level project site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

7 participants