question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test first_notebook_cell

See original GitHub issue

Would it be possible to run first_notebook_cell when running each of the examples to test that the contents are valid?

I imagine having Jupyter magic like %matplotlib inline might be a problem when executing examples in the test environment, but perhaps there is a way in which we could verify the code in first_notebook_cell such that projects aren’t shipping broken examples like what happened in https://github.com/pyvista/pyvista/issues/1711

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Oct 11, 2021

Am I understanding that first_notebook_cell isn’t actual run per example when generating the documentation? It is only added when users download the notebook?

Correct

I will open another feature request for having setup and teardown sections that are run when generating the documentation but not when downloading the example

We have https://sphinx-gallery.github.io/stable/configuration.html#reset-modules which might or might not do what you want already

1reaction
MatthewFlammcommented, Oct 11, 2021

Am I understanding that first_notebook_cell isn’t actual run per example when generating the documentation? It is only added when users download the notebook? This isn’t clear to me in the documentation https://sphinx-gallery.github.io/stable/configuration.html#add-your-own-first-and-last-notebook-cell. This seems to be true in my testing, but I wanted to confirm it.

If this interpretation is correct, I will open another feature request for having setup and teardown sections that are run when generating the documentation but not when downloading the example. This is the mirror functionality to first_notebook_cell and last_notebook_cell. This is useful when there is code that is modifying global settings in an example like in the aforementioned https://github.com/pyvista/pyvista/issues/1711, and we want to make sure that these settings do not leak out of the example when an error is raised.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing and debugging - Azure Quantum - Microsoft Learn
Learn how to use unit tests, facts and assertions, and dump functions to test and debug quantum programs.
Read more >
Adapting Your Own Training Container - Amazon SageMaker
Run the following command in the first notebook cell to change to the ... To test the container locally in the notebook instance,...
Read more >
Databricks Utilities | Databricks on AWS
Understand and learn how to use Databricks Utilities to work with object storage, to chain and parameterize notebooks, and to work with ...
Read more >
Common problems and solutions—ArcGIS Notebook Server
Check your network connection or notebook server configuration. ... When I run the default first notebook cell (including the string gis = GIS("home")), ......
Read more >
Quick Start — OceanSpy 0.2.0 documentation - Read the Docs
Copy and paste the following lines in the first notebook cell to import OceanSpy, ... Check out Tutorial, Use Cases, and API reference...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found