You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use a notebook to perform calculations, and one or more markdown files to write a document where I am using figures and variables from the notebook. Matplotlib plots created in the notebook are embedded using the recipe in docs. However, I am not able to use the eval role to embed a variable from the notebook. Steps to reproduce the observed behaviour are shown below.
I am running on:
mystmd v1.3.11
windows
Description
Please find below three files that can be used to reproduce the observed behaviour: 1) requirements.txt, 2) calculations.ipynb, and 3) report.md.
requirements.txt
The Python environment can be created with the dependencies given in requirements.txt:
matplotlib
jupyter-server
ipykernel
calculations.ipynb
A notebook with the following cells. The first and last cells are markdown, the remaining cells are python.
---title: Calculationsauthor: Name Namesonexports:
- format: pdfoutput: calculations.pdftemplate: plain_latex---
The calculation result is {eval}`calculation_result`.
If I do a myst build calculations.ipynb --pdf --execute the variable is embedded as expected. ✅
report.md
A markdown file with the following contents.
---title: The reportauthor: Name Namesonexports:
- format: pdfoutput: report.pdftemplate: plain_latexkernelspec:
name: python3display_name: venv---
:::{figure} #fig-cos
:label: figure-from-nb
The `cos` function.
:::
The calculation result is {eval}`calculation_result`.
If I do a myst build report.md --pdf --execute the matplotlib figure from the notebook is embedded as expected, but the variable calculation_result cannot be embedded. 💥
The following is printed in the terminal, possibly indicating that calculation_error cannot be found in the namespace available to report.md:
📬 Performing exports:
report.md -> report.pdf
💿 Executing Notebook (report.md) [no execution cache found]
💾 Adding Cached Notebook Outputs (calculations.ipynb)
📖 Built calculations.ipynb in 22 ms.
🚀 Starting new Jupyter server
🪐 Jupyter server started
http://localhost:8888/?token=3ce1d702a24b5985ac5c53a9717a45c105d6b0eb03cfc90d
Starting WebSocket: ws://localhost:8888/api/kernels/d2db867b-6de2-4d70-9f6f-a91bb3566705
⛔️ report.md An exception occurred during expression evaluation, halting further execution:
NameError: name 'calculation_result' is not defined
📖 Built report.md in 3.15 s.
...
It would be extremely powerful to have the ability to embed variables like this in markdown files and not only notebooks 🚀
The text was updated successfully, but these errors were encountered:
I want to use a notebook to perform calculations, and one or more markdown files to write a document where I am using figures and variables from the notebook. Matplotlib plots created in the notebook are embedded using the recipe in docs. However, I am not able to use the
eval
role to embed a variable from the notebook. Steps to reproduce the observed behaviour are shown below.I am running on:
Description
Please find below three files that can be used to reproduce the observed behaviour: 1) requirements.txt, 2) calculations.ipynb, and 3) report.md.
requirements.txt
The Python environment can be created with the dependencies given in
requirements.txt
:calculations.ipynb
A notebook with the following cells. The first and last cells are markdown, the remaining cells are python.
If I do a
myst build calculations.ipynb --pdf --execute
the variable is embedded as expected. ✅report.md
A markdown file with the following contents.
If I do a
myst build report.md --pdf --execute
the matplotlib figure from the notebook is embedded as expected, but the variablecalculation_result
cannot be embedded. 💥The following is printed in the terminal, possibly indicating that
calculation_error
cannot be found in the namespace available toreport.md
:It would be extremely powerful to have the ability to embed variables like this in markdown files and not only notebooks 🚀
The text was updated successfully, but these errors were encountered: