Skip to content
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

Enable thumbnail galleries of notebooks #396

Open
namurphy opened this issue Mar 9, 2022 · 7 comments
Open

Enable thumbnail galleries of notebooks #396

namurphy opened this issue Mar 9, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@namurphy
Copy link

namurphy commented Mar 9, 2022

Describe the problem/need and solution

Context
I'm working on a pull request to consider switching from nbsphinx to MyST-NB. Our documentation currently has thumbnail galleries that were created using the nbgallery directive from nbsphinx. The instructions in the MyST-NB documentation currently state that the notebooks should be included in a Sphinx :toctree: directive, which puts them in a table of contents format without thumbnail images.

Problem / Idea
I would like to use MyST-NB and be able to generate thumbnail galleries of example notebooks.

Solution

Ideally, I would like to be able to use a directive similar to nbgallery from nbsphinx when using MyST-NB. One possibility would be to make it so that this directive would be able to be used when MyST-NB is enabled as a Sphinx extension.

Another possibility would be to add an example in the documentation of how to use another Sphinx extension to create a thumbnail gallery while using MyST-NB for processing notebooks.

Benefit

The ability to generate a thumbnail gallery would remove a blocker that could prevent projects from switching to MyST-NB from nbsphinx or sphinx-gallery.

Guide for implementation

This comment describes a hack to generate a thumbnail gallery via nbsphinx while still using MyST-NB for tasks besides the thumbnail gallery.

My current understanding is that the code used to generate a thumbnail gallery has generally been bundled to the code used for processing notebooks. Ideally these would be decoupled from each other, which would make it easier to switch between sphinx-gallery, nbsphinx, and MyST-NB.

Along these lines, I'm also wondering if it would be possible to import only the nbgallery directive from nbsphinx to avoid needing to duplicate code.

Thank you!

Tasks and updates

No response

@namurphy namurphy added the enhancement New feature or request label Mar 9, 2022
@welcome
Copy link

welcome bot commented Mar 9, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@chrisjsewell
Copy link
Member

Heya, just to quickly note, I am certainly interested in something like this 👍
I feel, perhaps even more generally than sphinx-gallery or nbgallery, you could have an extension that simply generates a thumbnail gallery from any list of documents, a little similar to how ablog works (which is already integrated with myst-parser / myst-nb):

See e.g.:

@DominiqueMakowski
Copy link

Just to say that I support that, it would be a great feature!

@twiecki
Copy link

twiecki commented May 26, 2022

This would be quite useful for pymc as well: docs.pymc.io

@michaelweinold
Copy link
Contributor

@twiecki, it seems that PyMC Examples already has a neat script set up to generate a gallery of notebooks:

pymc-examples/sphinxext/thumbnail_extractor.py

Could this be adapted for use with MyST-NB? Would be happy to contribute to the PR once you have a first draft.

We would be happy to see this feature in MyST-NB, since sphinx-gallery relies on nbsphinx to generate a gallery.

@twiecki
Copy link

twiecki commented Apr 19, 2023

@michaelweinold That is using NBs directly it seems. I'm sure it could be adapted but I won't be able to help in that effort but would cheer on any such effort :).

@billbrod
Copy link

I wanted to check in, what is the current status of this? Has anyone put together a simple way to generate a thumbnail gallery?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants