Calysto / matlab_kernel

Jupyter Kernel for Matlab
Other
469 stars 76 forks source link

matlab_kernel not reset on reprocessing of Quarto document in VS Code #163

Open allefeld opened 1 year ago

allefeld commented 1 year ago

I posted the following previously on Stack Overflow but didn't receive any answers or comments, so I'm trying here:

There is something strange happening when using matlab_kernel in a document processed by the Quarto extension for VS Code.

Example file quarto_matlab_test.qmd:

---
title: test quarto & matlab_kernel
jupyter: matlab
---

```{matlab}
x
```

```{matlab}
x = 2
```

It appears that the Matlab kernel is not reset between Quarto processing runs, and variables as well as other settings are preserved.

The same does not happen with a Python kernel, and it does not happen with matlab_kernel in a notebook (ipynb). I'm not sure whether this is a bug in matlab_kernel, Jupyter, Quarto, or the Quarto extension.

Questions:

1) How do I debug this, so I can submit a bug report for the software which is the actual culprit? There are so many different pieces involved (see below).

2) Is there a workaround? A partial solution is to put clear variables into a code block at the top – but as mentioned this also applies to other settings (e.g. format), so it seems that one needs to figure out a sequence of reset commands depending on the document.

Versions:

Python 3.10.4
    jupyter_client 7.3.1
    jupyter_core 4.10.0
    matlab-kernel 0.17.1
    metakernel 0.29.4
    matlabengine 9.13.7
Matlab R2022b Update 4 (9.13.0.2166757)
Quarto 1.2.335
VS Code 1.75.1
    Quarto Extension 1.69.0