CreekGeek
CreekGeek

Reputation: 2329

automatically clear notebook output on close in Jupyter Lab?

Is there a default setting in Jupyter Lab to clear output for an entire notebook upon file closure?

Or a bit of code I could run early in the NB with import statements or similar. (I have some NBs where I don't run every cell every time I open).

My current workflow is to manually clear before save and exit, but I just encountered a repo commit where I'd forgotten to do that and I had a bit of an adrenaline spike as I flashed back to a corrupted notebook last year.

My interest is preventing potential problems and minimizing user-executable steps to do so. I'm not interested in stripping from the command line post-hoc.

This thread just clears individual cells.

I'm somewhat intrigued by this one but, without spending more time on it, not clear how much effort it would take to incorporate into my GitKraken flow.

This also seems promising, but again is on the back side of things.

Figured I'd check if I'm missing something much more fundamental.

Upvotes: 1

Views: 738

Answers (1)

Ala Tarighati
Ala Tarighati

Reputation: 3817

I'm using jupytext and convert my notebooks to markdown format, so whenever I close them, the outputs are cleared automatically. https://jupytext.readthedocs.io/en/latest/

Upvotes: 1

Related Questions