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

Change gallery building to use nbsphinx #206

Merged
merged 5 commits into from
Feb 3, 2023
Merged

Change gallery building to use nbsphinx #206

merged 5 commits into from
Feb 3, 2023

Conversation

angus-g
Copy link
Contributor

@angus-g angus-g commented Jan 23, 2023

Fixes #201 (see https://cosima-recipes.readthedocs.io/en/update-nbsphinx/tutorials/Using_Explorer_tools.html). However, we'll need to change how thumbnails are specified for galleries by tagging the cells with nbsphinx-thumbnail (https://nbsphinx.readthedocs.io/en/0.8.12/gallery/cell-tag.html). That's potentially pretty disruptive (will cause conflicts to everybody working on an existing notebook), so maybe we should wait for a quieter time to do that?

See the WIP builds for this branch at: https://cosima-recipes.readthedocs.io/en/update-nbsphinx/

  • fix static thumbnails (for tutorials), specified in conf.py
  • images in rendered notebooks not appearing?
  • fix dynamic thumbnails (for documented examples)
  • add instructions for setting thumbnails to contributing guide
  • fix warnings in notebooks
Notebook warnings

Warnings

From DocumentedExamples/Meridional_heat_transport.ipynb:

cosima-recipes/docs/documented_examples/Meridional_heat_transport.ipynb:70:
    WARNING: File not found: 'documented_examples/"../Tutorials/COSIMA_CookBook_Tutorial.ipynb"'

From DocumentedExamples/Surface_Water_Mass_Transformation.ipynb:

cosima-recipes/docs/documented_examples/Surface_Water_Mass_Transformation.ipynb::
    WARNING: Could not lex literal_block as "ipython3". Highlighting skipped.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@angus-g angus-g force-pushed the update-nbsphinx branch 2 times, most recently from 43e62db to 3b3e5fb Compare January 24, 2023 01:35
@angus-g
Copy link
Contributor Author

angus-g commented Jan 24, 2023

We need a link to the thumbnails for them to be copied over to the doctree to be usable in the gallery. Since this only really applies to the tutorials, maybe we can just find a good place to sneak the image in?

Solved by putting them in _static

@navidcy navidcy added the 💻 hackathon 2.0 like the 1.0 but better label Jan 24, 2023
@angus-g angus-g force-pushed the update-nbsphinx branch 4 times, most recently from 4e230a2 to 8da0721 Compare January 30, 2023 04:05
@angus-g
Copy link
Contributor Author

angus-g commented Jan 30, 2023

To get the original behaviour for defaulting thumbnails to the last image in a notebook, we'd need spatialaudio/nbsphinx#707 (or something similar) to land. At the moment I've pointed RTD to my branch which includes this change.

The way thumbnails are specified other than this default has also changed: either the image can go in docs/_static/thumbnails and a new entry goes in the nbsphinx_thumbnails key in docs/conf.py (see https://nbsphinx.readthedocs.io/en/latest/gallery/thumbnail-from-conf-py.html); or a cell can be tagged (https://nbsphinx.readthedocs.io/en/latest/gallery/cell-tag.html).

@aidanheerdegen
Copy link
Contributor

Hey @angus-g, sorry I only just got around to checking this out. Looks good from my perspective.

@angus-g angus-g force-pushed the update-nbsphinx branch 3 times, most recently from 28ed96e to 5384818 Compare February 1, 2023 23:18
@navidcy
Copy link
Collaborator

navidcy commented Feb 2, 2023

I see some conflicts here have risen in the Compare_SSH_model_obs.ipynb example.
I presume is the changes from # -> ##?

@angus-g
Copy link
Contributor Author

angus-g commented Feb 2, 2023

I see some conflicts here have risen in the Compare_SSH_model_obs.ipynb example. I presume is the changes from # -> ##?

Yeah, that's fine, I can resolve that. I still need to put some docs together for managing thumbnails, and it would be nice for the upstream PR to work first. Other than that, it's probably getting to a quiet enough time to switch over to nbsphinx and get prettier rendered notebooks!

@navidcy
Copy link
Collaborator

navidcy commented Feb 2, 2023

Do that!

@navidcy
Copy link
Collaborator

navidcy commented Feb 2, 2023

and open a new PR to keep working :)

nbsphinx changes the toctree, so level 1 headers are going in as new
TOC entries. We need to de-indent some of these to make the structure
a bit more normal. We also fix an incorrect link in the MHT notebook.
We need to move them to the _static directory
@angus-g
Copy link
Contributor Author

angus-g commented Feb 3, 2023

@navidcy mind having a poke around the build https://cosima-recipes--206.org.readthedocs.build/en/206/ and seeing if there's anything obviously broken? Otherwise I think this is ready to merge!

@navidcy
Copy link
Collaborator

navidcy commented Feb 3, 2023

The explorer tutorial looks great! Merge!

@angus-g angus-g merged commit 62b232a into master Feb 3, 2023
@angus-g angus-g deleted the update-nbsphinx branch February 3, 2023 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 hackathon 2.0 like the 1.0 but better technical
Development

Successfully merging this pull request may close these issues.

Save Explorer Notebook widget state
3 participants