executablebooks / MyST-NB

Parse and execute ipynb files in Sphinx
https://myst-nb.readthedocs.io
BSD 3-Clause "New" or "Revised" License
211 stars 84 forks source link

Code-cell reading from files using :load: should not use cache if the file has changed #621

Open gibberblot opened 2 months ago

gibberblot commented 2 months ago

Describe the bug

I use the :load: tags for code-cells so much in my book; e.g.:

:load: <path>

This is documented as an experimental feature.

When I change the file as , I expect that this cell should be executed instead of reading from the cache.

But instead, it reads from the cache.

This means I have to force execution, or change the cell just to get it to re-execute.

Thanks! Tim

p.s. I love this functionality!

Reproduce the bug

In any jupyterbook, create the file test.py with the following:

print("1")

Load it in a code cell:

:load: test.py

and build the book.

Now change test.py to:

print("2")

and re-build. You will still get the output ("1"), and it is clear from the execution log that this was cached.

List your environment

Jupyter Book : 1.0.0 External ToC : 1.0.1 MyST-Parser : 2.0.0 MyST-NB : 1.0.0 Sphinx Book Theme : 1.1.2 Jupyter-Cache : 0.6.1 NbClient : 0.7.4

Python 3.10.12

WSL on Windows 11