srstevenson / nb-clean

Clean Jupyter notebooks of outputs, metadata, and empty cells, with Git integration
https://pypi.org/project/nb-clean/
ISC License
131 stars 18 forks source link

Preserve execution count when using `nb-clean` #221

Closed thatlittleboy closed 9 months ago

thatlittleboy commented 9 months ago

Is it possible to retain the cell execution count when using nb-clean?

My objective is just to remove metadata, while retaining cell execution count and cell outputs.

I'm not sure if this option exists (not clear to me from reading nb-clean clean --help)

I'm using this at the moment

nb-clean clean -eo <...ipynb>

If it doesn't exist, would you consider adding this option to nb-clean? thanks.

srstevenson commented 9 months ago

This isn't currently supported, but is something we can add. Are you interested in contributing the PR for this? I suggest passing a new boolean argument preserve_execution_counts to the check_notebook and clean_notebook functions, like we pass preserve_cell_outputs.

thatlittleboy commented 9 months ago

Sure, I'ld love to give it a go.

srstevenson commented 9 months ago

Feel free to push any work in progress as a draft PR, and tag me if you have any questions.