Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added clear kwarg to display() #12823

Merged
merged 1 commit into from Apr 17, 2021
Merged

Added clear kwarg to display() #12823

merged 1 commit into from Apr 17, 2021

Conversation

dsblank
Copy link
Contributor

@dsblank dsblank commented Feb 19, 2021

display() is a very useful function in the ipython kernel (especially now that it is in scope by default). However, many times that I use it, I also need clear_output(), and clear_output(wait=True). However, it is quite a pain to have to:

from IPython.display import clear_output

In addition, many user don't know about clear_output, nor the wait option.

This PR adds display(clear=True) with wait=True by default. If you want to clear it now rather than later, you can:

display(clear=True)
print() # forces the clear now!

@dsblank
Copy link
Contributor Author

dsblank commented Feb 19, 2021

@martinRenou What do you think about this? Also, not sure why it failed... I think a formatting rule, but I couldn't get "dark" to re-format it.

@Carreau
Copy link
Member

Carreau commented Feb 26, 2021

I have no objections with that; if it's ok with the xeus folks to make sure we don't have diverging implementation.
I'll take care of the reformatting.

@dsblank
Copy link
Contributor Author

dsblank commented Feb 26, 2021

I must admit that I don't understand the consistency check with xeus. There are quite a few kernels that have "display" functions. Is there some project to try to keep some core functionality consistent across kernels? If so, metakernel should be in the loop.

Anyway, if you point me to the xeus implementation, I can make a PR there too.

@martinRenou
Copy link
Contributor

Now that xeus-python depends on IPython there should not be any problem on our side :) It should work out of the box with this change.

@dsblank
Copy link
Contributor Author

dsblank commented Mar 3, 2021

@Carreau I guess this is ready then?

@Carreau Carreau added this to the 7.23 milestone Apr 17, 2021
@Carreau
Copy link
Member

Carreau commented Apr 17, 2021

Rebased on master and applied autoformatting where linter was complaining.

@Carreau
Copy link
Member

Carreau commented Apr 17, 2021

Test are passing, merging. Shis should be automatically backported and will thus be release at end of month.

@Carreau Carreau merged commit bb21d60 into ipython:master Apr 17, 2021
@lumberbot-app
Copy link
Contributor

lumberbot-app bot commented Apr 17, 2021

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout 7.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 bb21d60fffa7036c7f5827b479026b94748e2ffd
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #12823: Added clear kwarg to display()'
  1. Push to a named branch :
git push YOURFORK 7.x:auto-backport-of-pr-12823-on-7.x
  1. Create a PR against branch 7.x, I would have named this PR:

"Backport PR #12823 on branch 7.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@lumberbot-app lumberbot-app bot added the Still Needs Manual Backport Added My MrMeeseeks when a backport fails. Help by backporting it, solving conflicts, send PR. label Apr 17, 2021
Carreau added a commit to Carreau/ipython that referenced this pull request Apr 17, 2021
Carreau added a commit to Carreau/ipython that referenced this pull request Apr 17, 2021
Carreau added a commit that referenced this pull request Apr 17, 2021
@Carreau Carreau removed the Still Needs Manual Backport Added My MrMeeseeks when a backport fails. Help by backporting it, solving conflicts, send PR. label Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants