kynan / nbstripout

strip output from Jupyter and IPython notebooks
Other
1.19k stars 94 forks source link

Allow stripping outputs from `init_cell` cells. #156

Closed Pugio closed 2 years ago

Pugio commented 3 years ago

I have a whole bunch of notebooks which have the init_cell: true metadata. This generates a nice default set of UI widgets as soon as the notebook is loaded. However, since this is generated automatically, I don't want all the widget output checked into my source repo. Right now, every time a user commits a change to the notebook, we have huge amounts of cell output from the init_cell cells.

I would like to add a flag: --strip-init-cells which alters the current behavior to also remove outputs from init. I haven't submitted this as a PR (should I?) but I have an implementation of this at: https://github.com/Pugio/nbstripout/commit/adbf05b967b7f6d1fcdd36ed9c5d968fb6b2ddfa .

kynan commented 2 years ago

Sure, feel free to send a PR!

kynan commented 2 years ago

@Pugio feel free to close if you feel this is addressed. Will be part of the upcoming 0.5.1 release.

Pugio commented 2 years ago

Thank you!

kynan commented 2 years ago

@Pugio can you remind me what the init_cell metadata is used for? And which tool / extension is adding it?

I wonder if the default should be changed i.e. stripping by default and only keep if --keep-init-cells is passed?