I would like to push my notebooks into GitLab without them showing the different outputs (3d plots, dataframes, etc...) in order to keep the size of those notebooks reasonable.
I had the following idea: setting up a boolean variable at the beginning of the notebook that when set to True, the %%capture cell-magic command would activate in every cell it is in.
import various libraries
## Setting the boolean variable to True:
do_not_show = True
## This cell would not display anything
if do_not_show:
%%capture
plt.plot(...)
plt.savefig(...)
So, is there a way to write the if statement (or more generally, any lines of code) at the beginning of each existing cell of a notebook? Moreover, would there be a way to automatically write those lines of code automatically when creating a new cell?
Adding the if statement in each required cell is quite tedious for long notebooks...