Skip to content

Unable to Stop nb Execution While Embedding Within rst File #694

@AhmedYousriSobhi

Description

@AhmedYousriSobhi

Describe the bug

context
I'm trying to include a notebook to be embedded with rst file, so it displayed inline with our text context inside that rst file, instead of having a separate page of my NB.
When I try to stop notebook execution during build process with adding include inside the rst file:

  .. include:: notebooks/mynotebook.ipynb
      :parser: myst_nb.docutils_

and also stopped the execution inside the conf.py file with option:

nb_execution_mode = 'off'

expectation
I expected that nb is not being executed during build html, and it just put the existing output.

bug
But instead the execution of notebooks happens
Here's an error message I ran into during make html

reading sources... 
[ 28%] Path-to/ol/workdir/docs/source/Path-to/mynotebook.ipynb: Excluded from execution by pattern: 'source/Path-to/*.ipynb' [mystnb] reading sources... 
[ 28%] Path-to/ol/workdir/docs/source/Path-to/mynotebook.ipynb: Excluded from execution by pattern: 'source/Path-to/*.ipynb' 
[mystvinb] source/Path-to/mynotebook.ipynb:: (WARNING/2) Executing notebook failed: CellExecutionError [mystnb.exec] source/Path-to/mynotebook.ipynb:: (WARNING/2) Executing notebook failed: CellExecutionError [mystnb.exec] source/Path-to/mynotebook.ipynb:: (WARNING/2) Executing notebook failed: CellExecutionError [mystnb.exec] source/Path-to/mynotebook.ipynb:: (WARNING/2) Executing notebook failed: CellExecutionError [mystnb.exec]

problem
This is a problem is that I can't stop notebook execution when the notebook is included with in .rst file, although it's being excluded in case it's a separate page included in index.rst file

Reproduce the bug

  1. Inside any sphinx project, create an .rst file with some context.
  2. Include the notebook with in the .rst file with:
  .. include:: notebooks/mynotebook.ipynb
      :parser: myst_nb.docutils_
  1. Stop the notebook execution with adding nb_execution_mode = 'off' in the conf.py file.
  2. Make html of the sphinx project to generate the html output.

Note:

  1. During the build process, the output shows that it tries to execute the notebook.

List your environment

Jupyter Book      : 1.0.4.post1
External ToC      : 1.0.1
MyST-Parser       : 3.0.1
MyST-NB           : 1.3.0
Sphinx Book Theme : 1.1.4
Jupyter-Cache     : 1.0.1
NbClient          : 0.10.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions