-
Notifications
You must be signed in to change notification settings - Fork 90
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
ENH: Simple install_kicker() #807
Conversation
Codecov Report
@@ Coverage Diff @@
## master #807 +/- ##
==========================================
- Coverage 85.98% 85.86% -0.12%
==========================================
Files 18 18
Lines 4881 4890 +9
==========================================
+ Hits 4197 4199 +2
- Misses 684 691 +7
Continue to review full report at Codecov.
|
I like this thought. Forgive me for raining on this PR with some complications -- but then one positive suggestion.
But let me suggest this solution: ask matplotlib which backend it is using and use that to differentiate which kicker to install. A kernel might have multiple front-ends, but matplotlib can only have one backend at a time, and that's the real determining factor as to which kicker we need. |
@danielballan suggestions are always welcome! 👍 How do you guys have old IPython running since every deploy the environments are wiped out and recreated with the new cycle? I will take a look at your suggestion and send modifications to the PR. |
We don't wipe out the old conda environments (anymore, anyway). We keep them around so that old user notebooks can run on their original kernels without suffering from API changes. |
I see! I will work on the suggested changes... |
The "inline" magic isn't a real backend; it's sort of an IPython hack. It can't do live-updating plots anyway, so I don't think we have to worry about it for the purposes of the kicker. |
|
This kicker may work for all GUI backends def _kicker()
Gcf.draw_all()
# there is not a singleton exposed through Mpl, but all of the GUI backends have one (and
plt.gcf().canvas.flush_events()
loop.call_later(0.03, _kicker) but may not work for nbagg or ipympl |
For the record, my wife has inquired why we are kicking backends. We work in a strange profession. |
Or I should just not be allowed to name things.... |
@hhslepicka I took the liberty of rebasing and force-pushing to this branch. This is the approach I was suggesting. Can you check that it works for you before we merge? |
bump @hhslepicka |
@danielballan sorry for the delay. I did some tests and it worked for my using iPython and the notebook. |
I like this. Codecov seems to complain. Is there an easy way to test something like this or should we just ignore? Maybe add this to .coveragerc in main dir?
|
This one is hard to test programmatically but quite easy to test interactively. Since we use it regularly, the risk of an unnoticed regression seems low. I would be inclined to let coverage continue to shame us (that is, not silence it by modifying |
sounds good. If someone can confirm they've tested it for both ipython and jupyter I second on merging. |
Looks like Hugo confirmed it since the most recent commit was added. Merging! |
@danielballan yes I did! Thank you for merging. 👍 |
oops yes thanks @hhslepicka ! useful addition! |
Usually users need to call either
install_qt_kicker
orinstall_nb_kicker
in order to get the live plots and other callbacks to work properly. The idea of this PR is to add a functionality that I added to LIX while working there to make it easier for the user by just installing the correct one based on how they are running the code.Description
Added a method at utils.py named
install_kicker
which based on the environment will install either qt_kicker or nb_kicker.Motivation and Context
It simplifies the setup of the kicker.
How Has This Been Tested?
Locally tested.