Papermill: Hide all input for output notebook

Created on 7 Apr 2018  Â·  11Comments  Â·  Source: nteract/papermill

From a user:

It would be cool if papermill had an option to hide code cell input when generating an output notebook. This could be very helpful when generating a nightly report and not wanting to see the code that generates the report.

Simple enough. nteract uses metadata.inputHidden as a boolean value to indicate if a cell's input is hidden.

I suppose a flag like --hide-inputs or something? Maybe if we wanted to be more opinionated about the naming we'd call it --report-mode or --mode=report?

Thus far convergence on flag name is --report-mode.

new-contributor-friendly

Most helpful comment

This is functionality already built into nbconvert, on the command line
this would be the flag --TemplateExporter.exclude_input=True

On Fri, Apr 6, 2018 at 15:49 Kyle Kelley notifications@github.com wrote:

From a user:

It would be cool if papermill had an option to hide code cell input when
generating an output notebook. This could be very helpful when generating a
nightly report and not wanting to see the code that generates the report.

Simple enough. nteract uses metadata.inputHidden as a boolean value to
indicate if a cell's input is hidden.

I suppose a flag like --hide-inputs or something? Maybe if we wanted to
be more opinionated about the naming we'd call it --report-mode or
--mode=report?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nteract/papermill/issues/130, or mute the thread
https://github.com/notifications/unsubscribe-auth/ACXg6PMwKbxpov_ApmkpPyhf-zOluYpRks5tl_ENgaJpZM4TKzQT
.

All 11 comments

This is functionality already built into nbconvert, on the command line
this would be the flag --TemplateExporter.exclude_input=True

On Fri, Apr 6, 2018 at 15:49 Kyle Kelley notifications@github.com wrote:

From a user:

It would be cool if papermill had an option to hide code cell input when
generating an output notebook. This could be very helpful when generating a
nightly report and not wanting to see the code that generates the report.

Simple enough. nteract uses metadata.inputHidden as a boolean value to
indicate if a cell's input is hidden.

I suppose a flag like --hide-inputs or something? Maybe if we wanted to
be more opinionated about the naming we'd call it --report-mode or
--mode=report?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nteract/papermill/issues/130, or mute the thread
https://github.com/notifications/unsubscribe-auth/ACXg6PMwKbxpov_ApmkpPyhf-zOluYpRks5tl_ENgaJpZM4TKzQT
.

I like --report-mode or --mode=report over --hide-input.

Can I take a stab at this?

Sure thing! Let us know how it is going and feel free to create a PR marked as "work in progress" as soon as you feel like you have something to share (even if it is a long way from being done).

Ok, thanks! Will do so.

Since we'll only have one mode to begin with, we should just call this --report-mode for now.

@cldssty since this is already a traitlet in nbconvert you could get away with adding a flag to the papermill jupyter app and setting the value of that nbconvert option (which I mention above).

Oh wait… this isn’t a JupyterApp… is there any reason why? Doing so would make a lot of the logic in the CLI a lot simpler and make it much easier to configure other jupyter parts like the kernel manager & nbconvert.

I _think_ it would be fine if this was a JupyterApp. We were happy with using click and weren't aware of the benefits of it being a JupyterApp.

135

Have made an attempt - please tell me what to add/change. Thanks!

Hi, I got a question about this feature. I run papermill like this: papermill --report-mode input.ipynb output.ipynb -p ... I expected that output.ipynb will have input cells hidden if I open it with the jupyter notebook but actually input cells (e.g. code cells) are not hidden. How is this flag supposed to work?

@OrKoN This feature was relatively new, all of the tools have adopted it except jupyter classic as far I know. I looked at the code involved there and kicked a comment in https://github.com/jupyter/notebook/issues/534 to see if we can get classic to also respect it soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

willingc picture willingc  Â·  4Comments

otterotter408 picture otterotter408  Â·  7Comments

yogevyuval picture yogevyuval  Â·  6Comments

omar-masmoudi picture omar-masmoudi  Â·  4Comments

casperdcl picture casperdcl  Â·  7Comments