Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

clear In[] prompt numbers on "Clear All Output" #1621

Merged
merged 1 commit into from Apr 19, 2012

Conversation

Projects
None yet
4 participants
Owner

ivanov commented Apr 18, 2012

For more version-control-friendly .ipynb files, I've found it useful to strip the In[] prompt numbers when doing a "Clear all output".

I noted in the commit here that this should be a configurable behavior, and would love a pointer for how to proceed with making it configurable (using some javascript checkbox widget?)

I'm equally happy with amending this commit to just be the default, and punting on the configurability until a later date.

Owner

fperez commented Apr 18, 2012

Let's punt on configurability for now: I think that should be the default behavior, since once output has been removed, the input numbers don't mean much anymore. We'll need to revisit the configuration problem for the web client later on, but we shouldn't stall good updates because of not having that done yet.

Owner

ivanov commented Apr 18, 2012

ok, so should i just replace my comments with just something like "Make all In[ ] prompts blank. TODO: make this configurable in the future" ?

Owner

fperez commented Apr 18, 2012

sounds good

Owner

ivanov commented Apr 18, 2012

ok, updated the comment, now it's ready to be merged

Owner

fperez commented Apr 18, 2012

I'm +1 on merging this, let's give it a day or so in case anyone else wants to have a look. Thanks!

Owner

minrk commented Apr 19, 2012

This seems sensible to me, though it does discard some information about execution if you continue to use the notebook in the same session after clearing it (as opposed to saving immediately and re-opening later on a fresh kernel).

It seems like a combined 'fresh start == restart kernel + clear_all_output' would be a useful and more clearly consistent action, though I suppose clicking two buttons is not too much to ask.

Owner

minrk commented Apr 19, 2012

Oh, in case that meandering wasn't clear, I am +1 to merge as well.

Owner

fperez commented Apr 19, 2012

OK, let's merge it then. @minrk, you're right in that a full 'fresh start' option would probably be a good idea, but even with the points you mention, I think in practice for the purposes of saving for version control, this is a big improvement.

fperez added a commit that referenced this pull request Apr 19, 2012

Merge pull request #1621 from ivanov/clear-input-prompt-on-clear-all-…
…output

clear In[] prompt numbers on "Clear All Output"

For more version-control-friendly `.ipynb` files, this strips the `In[]` prompt numbers when doing a "Clear all output".  This reduces the amount of noise in commit-to-commit diffs that would otherwise show the (highly variable) prompt number changes.

@fperez fperez merged commit 187d009 into ipython:master Apr 19, 2012

Owner

fperez commented Apr 19, 2012

All merged, thanks again @ivanov for the work!!

Owner

ivanov commented Apr 19, 2012

thanks for the feedback and the merging. what can I say, i'm very fond of one-liner fixes :)

I tend to forget about this from time to time. Would be nice to have the option to do this automatically on save...

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014

Merge pull request #1621 from ivanov/clear-input-prompt-on-clear-all-…
…output

clear In[] prompt numbers on "Clear All Output"

For more version-control-friendly `.ipynb` files, this strips the `In[]` prompt numbers when doing a "Clear all output".  This reduces the amount of noise in commit-to-commit diffs that would otherwise show the (highly variable) prompt number changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment