Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cached globals in Jupyter notebook [low prio] #6

Open
Splines opened this issue Dec 26, 2023 · 0 comments
Open

Cached globals in Jupyter notebook [low prio] #6

Splines opened this issue Dec 26, 2023 · 0 comments

Comments

@Splines
Copy link
Collaborator

Splines commented Dec 26, 2023

One annoyance I've encountered is that jupyter notebooks in VSCode cache global variables. This unnecessarily bloats your results.tex and might even lead to bigger issues if variables are thought to be redefined but a small spelling mistake leads to two slightly different variable names to be written to results.tex.

Solutions could be:

  • Find out if one can turn the caching behavior off in Jupyter notebooks in VSCode. However, this basically gets rid of the gist of the Jupyter notebooks in the first place as we want to have variables available in subsequent cells. So, this is not really an option.
  • Basically, we want to detect if variables are not defined anymore, e.g. they were defined in a cell but got removed from the cell, such that the next cell execution does not redefine that variable. Maybe there are specific settings in VSCode to then get rid of the old variable. Or maybe we have to write our own parsing logic to detect these cases. One has to also take into account that the user might have specified the variable in another cell in the meantime such that it shouldn't go out of scope.

One simple and easy fix is to restart the Python kernel used for the Jupyter notebook and then re-run all cells consecutively via one click. While this is a valid option I use frequently, it might take too long in bigger projects where cells have more complex tasks.

@Splines Splines mentioned this issue Feb 14, 2024
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant