papermill icon indicating copy to clipboard operation
papermill copied to clipboard

report_mode has no effect on the output notebook

Open mirekphd opened this issue 5 years ago • 1 comments

I'm trying to hide all or selected Jupyter notebook's input cells in the (output) file created by papermill's execute_notebook() (see this question why). According to the help, desired action should be achievable by simply setting report_mode=True in execute_notebook():

report_mode : bool, optional
    Flag for whether or not to hide input. 

but this setting has no effect on the output notebook.

My function call is as follows:

out_nb = pm.execute_notebook(input_path='./%s' % input_notebook,
                    output_path='./%s' % output_notebook,
                    parameters = updated_settings_dict,
                    nest_asyncio=True, # workaround for Issue #490
                    log_output=False,
                    report_mode=True, # for hiding all inputs, incl. injected vars
                    progress_bar=True)

I've latest versions of all necessary packages in a python 3.7 docker container based on jupyter/base-notebook.

mirekphd avatar May 26 '20 15:05 mirekphd

Likely you're hitting the issue that the classic UI does not get any updates these days. It doesn't support some of the newer format spec options like source_hidden. Jupyter Lab and Nteract open source UIs, and most proprietary ones, do support the flag and will hide source code. You can check that the report_mode flag is being set by inspecting the output ipynb file and looking for:

    "jupyter": {
     "source_hidden": true
    },

in the metadata of each code cell.

MSeal avatar May 26 '20 18:05 MSeal