Skip to content

{eval}thing does not work with nb_execution_mode == 'off' #596

Open
@flying-sheep

Description

Describe the bug

context
The {eval} role (user expressions) are not functional in a notebook rendered with nb_execution_mode == 'off'.

expectation
I expected the renderer to simply fetch the existing execution results from the cell metadata.

bug
I get WARNING: This document does not have a running kernel instead.

problem
This is a problem for people using user expressions/the eval role/directive, because it makes them needlessly useless with nb_execution_mode == 'off'.

Reproduce the bug

  1. create a notebook with a code cell x = 1 and a Markdown cell containing {eval}`x` .

  2. Execute the notebook. This results in this output being stored in the cell metadata:

      {
       "cell_type": "markdown",
       "metadata": {
        "user_expressions": [
         {
          "expression": "x",
          "result": {
           "data": {
            "text/plain": "1'"
           },
           "metadata": {},
           "status": "ok"
          }
         }
        ]
       },
       "source": [
        "{eval}`x`"
       ]
      },
  3. Set nb_execution_mode = 'off' and build the documentation.

  4. You get the above warning and don’t see the output from the cell metad

List your environment

>>> hatch run docs:pip list
Package                       Version    Editable project location
----------------------------- ---------- ---------------------------------------------------
accessible-pygments           0.0.4
alabaster                     0.7.13
asttokens                     2.4.1
attrs                         23.1.0
Babel                         2.14.0
beautifulsoup4                4.12.2
certifi                       2023.11.17
charset-normalizer            3.3.2
click                         8.1.7
comm                          0.2.0
debugpy                       1.8.0
decorator                     5.1.1
docutils                      0.20.1
executing                     2.0.1
fastjsonschema                2.19.0
greenlet                      3.0.2
idna                          3.6
imagesize                     1.4.1
importlib-metadata            7.0.0
ipykernel                     6.27.1
ipython                       8.18.1
jedi                          0.19.1
Jinja2                        3.1.2
jsonschema                    4.20.0
jsonschema-specifications     2023.11.2
jupyter-cache                 1.0.0
jupyter_client                8.6.0
jupyter_core                  5.5.0
latexcodec                    2.0.1
markdown-it-py                3.0.0
MarkupSafe                    2.1.3
matplotlib-inline             0.1.6
mdit-py-plugins               0.4.0
mdurl                         0.1.2
myst-nb                       1.0.0
myst-parser                   2.0.0
nbclient                      0.9.0
nbformat                      5.9.2
nest-asyncio                  1.5.8
packaging                     23.2
parso                         0.8.3
pexpect                       4.9.0
pip                           23.3.1
platformdirs                  4.1.0
prompt-toolkit                3.0.43
psutil                        5.9.6
ptyprocess                    0.7.0
pure-eval                     0.2.2
pybtex                        0.24.0
pybtex-docutils               1.0.3
pydata-sphinx-theme           0.14.4
Pygments                      2.17.2
python-dateutil               2.8.2
PyYAML                        6.0.1
pyzmq                         25.1.2
referencing                   0.32.0
requests                      2.31.0
rpds-py                       0.13.2
scverse-tutorials             0.0.1      /home/phil/Dev/Python/Single Cell/scverse-tutorials
setuptools                    69.0.2
six                           1.16.0
snowballstemmer               2.2.0
soupsieve                     2.5
Sphinx                        7.2.6
sphinx-autodoc-typehints      1.25.2
sphinx-book-theme             1.1.2
sphinx-copybutton             0.5.2
sphinxcontrib-applehelp       1.0.7
sphinxcontrib-bibtex          2.6.1
sphinxcontrib-devhelp         1.0.5
sphinxcontrib-htmlhelp        2.0.4
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.6
sphinxcontrib-serializinghtml 1.1.9
sphinxext-opengraph           0.9.1
SQLAlchemy                    2.0.23
stack-data                    0.6.3
tabulate                      0.9.0
tornado                       6.4
traitlets                     5.14.0
typing_extensions             4.9.0
urllib3                       2.1.0
wcwidth                       0.2.12
wheel                         0.42.0
zipp                          3.17.0

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