These are chat archives for ipython/ipython

21st
Nov 2014
Min RK
@minrk
Nov 21 2014 00:18
@kpeeters still around?
Kyle Kelley
@rgbkrk
Nov 21 2014 04:36
Hey, should None appear in In[] on Notebooks on nbviewer that don't have numbering?
I used master to update Julia's benchmark notebook to nbformat4
Jessica B. Hamrick
@jhamrick
Nov 21 2014 04:37
In IPython 2 it’s a bug
It’s fixed in master
Kyle Kelley
@rgbkrk
Nov 21 2014 04:37
hmmm
maybe I used the wrong one here
Jessica B. Hamrick
@jhamrick
Nov 21 2014 04:38
Rather, it’s a bug with nbconvert
Not with the notebook format
Kyle Kelley
@rgbkrk
Nov 21 2014 04:38
I'll reinstall IPython master
I thought I was on it...
buggers
Jessica B. Hamrick
@jhamrick
Nov 21 2014 04:39
Well if it’s being displayed on nbviewer then that’s using nbconvert from ipython 2, right?
ipython/ipython#6706
Min RK
@minrk
Nov 21 2014 04:39
nbviewer's using 2.x, I think
Kyle Kelley
@rgbkrk
Nov 21 2014 04:40
oh
I thought we made nbviewer upgrade nbformat
oh
Right, nbviewer is on the latest 2.x
Well then
Min RK
@minrk
Nov 21 2014 04:41
we can backport 6706 to 2.x
Kyle Kelley
@rgbkrk
Nov 21 2014 04:41
My PR to Julia's site stands
I went in just to fix a comma in the JSON, updated the format, then saw that
Not a big deal
We will end up seeing issues about it of course. :P
Jessica B. Hamrick
@jhamrick
Nov 21 2014 04:42
Hmm, that’s odd. I’ve only seen it showing up if you actually delete the prompt numbers (not just clear them)
Or, wait, the other way around I think
Kyle Kelley
@rgbkrk
Nov 21 2014 04:42
Should I open this notebook, save it, then close it
Jessica B. Hamrick
@jhamrick
Nov 21 2014 04:43
But i.e. from using something like ClearOutputPreprocessor in nbconvert, so that’s weird that you saw it just from editing a notebook.
Kyle Kelley
@rgbkrk
Nov 21 2014 04:43
Well this was a silly idea
diff --git a/benchmarks.ipynb b/benchmarks.ipynb
index 0b19c4c..2c58a1f 100644
--- a/benchmarks.ipynb
+++ b/benchmarks.ipynb
@@ -72,7 +72,21 @@
   }
  ],
  "metadata": {
-  "language": "Julia"
+  "kernelspec": {
+   "display_name": "IPython (Python 2)",
+   "name": "python2"
+  },
+  "language": "Julia",
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 2
+   },
+   "mimetype": "text/x-python",
+   "name": "python",
+   "pygments_lexer": "ipython2"
+  },
+  "signature": "sha256:f926a8f562af5bf778f6d62e292d9f008e5e0526d4e069a8466b47294f045bbd"
  },
  "nbformat": 4,
  "nbformat_minor": 0
(I don't have Julia on this system, so it took my Python kernel)
Won't be committing that
Jessica B. Hamrick
@jhamrick
Nov 21 2014 04:44
Hahaha, whoops :)
Min RK
@minrk
Nov 21 2014 04:54
Backported #6706
Kyle Kelley
@rgbkrk
Nov 21 2014 04:58
Cool, I think I just need to trigger a build and then do the deploy finagling
What I think I'll do then is finally review the PRs that are sitting around there
Thomas Arildsen
@ThomasA
Nov 21 2014 13:44
Is it OK to ask a support question here?
Kyle Kelley
@rgbkrk
Nov 21 2014 13:46
Feel free to ask
We're not always here
But can try to help with IPython related issues
Thomas Arildsen
@ThomasA
Nov 21 2014 13:57
I am trying to hide output from matplotlib.pyplot.plot (that figure "address" returned by the function) in an IPython notebook. I have an example here: https://gist.github.com/ThomasA/6536eef66e072572a4d3
The output IS hidden in the notebook viewer by using the semicolon in plt.plot(x,y);, but it seems like it is still included in the notebook JSON file:
"text": [
  "<matplotlib.figure.Figure at 0x7f1320bda750>"
]
Can I omit it completely somehow?
Kyle Kelley
@rgbkrk
Nov 21 2014 14:01
oh hm
usually that's it
give me a sec here
Oh right
This suppressed the name
Wondering if inline causes that
Yeah I'm totally not the person to answer this apparently
Kyle Kelley
@rgbkrk
Nov 21 2014 14:06
Even plt.plot(); will
Is there an alternate way to plot that just gives you the figure handle?
Thomas Arildsen
@ThomasA
Nov 21 2014 14:07
Hmm, not sure really
Lion Krischer
@krischer
Nov 21 2014 14:08
I guess one can just assign it: _ = plt.plot(x, y) but that is only an ugly workaround
Kyle Kelley
@rgbkrk
Nov 21 2014 14:09
no, assigning it still produces the plot
Lion Krischer
@krischer
Nov 21 2014 14:09
There is an object oriented interface in matplotlib, but most plot commands return something.
Kyle Kelley
@rgbkrk
Nov 21 2014 14:10
If I use direct functions on the plot here, it doesn't show until I run plt.show()
Thomas Arildsen
@ThomasA
Nov 21 2014 14:10
I want to see the plot, but I would like to get rid of the:
   "text": [
    "<matplotlib.figure.Figure at 0x7f1320d16710>"
   ]
Kyle Kelley
@rgbkrk
Nov 21 2014 14:10
%matplotlib inline
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt


# Example data
people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')
y_pos = np.arange(len(people))
performance = 3 + 10 * np.random.rand(len(people))
error = np.random.rand(len(people))

plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4)
plt.yticks(y_pos, people)
plt.xlabel('Performance')
plt.title('How fast do you want to go today?')

#plt.show()
Thomas Arildsen
@ThomasA
Nov 21 2014 14:10
It is suppressed in the visual output, but it stays in the notebook JSON file.
Kyle Kelley
@rgbkrk
Nov 21 2014 14:11
Oh, the text goes away for me using the semi-colon
hmmm
Thomas Arildsen
@ThomasA
Nov 21 2014 14:11
I am using IPython 2.2.0, could that be it?
Kyle Kelley
@rgbkrk
Nov 21 2014 14:12
The site I linked uses IPython master
Could be, but could be matplotlib version too
Thomas Arildsen
@ThomasA
Nov 21 2014 14:14
matplotlib is 1.4.0 here.
Damian Avila
@damianavila
Nov 21 2014 14:14
but wait... @rgbkrk, using the semicolon suppress the text reference in the the ipynb file?
it suppress the text in the "view" of the ipynb... but it the ipynb itself... i was seeing it in your tmpnb instance... let me see again...
Kyle Kelley
@rgbkrk
Nov 21 2014 14:17
aha!
It is suppressed
Thomas Arildsen
@ThomasA
Nov 21 2014 14:18
I was just checking the notebook you referred from tmpnb above. The "handle" is still hidden in the ipynb file:
<matplotlib.figure.Figure at 0x7fd29e7425c0>
Kyle Kelley
@rgbkrk
Nov 21 2014 14:18
Yeah
Damian Avila
@damianavila
Nov 21 2014 14:18
yeah
Kyle Kelley
@rgbkrk
Nov 21 2014 14:18
I think that's just a text representation of the display_data output_type
Damian Avila
@damianavila
Nov 21 2014 14:18
exactly
well, I think the same... :wink:
Kyle Kelley
@rgbkrk
Nov 21 2014 14:19
Note what's inside the one without the semi-colon
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 5,
       "text": [
        "[<matplotlib.lines.Line2D at 0x7f1320c8a110>]"
       ]
That entry is not in the plt.plot(); outputs
I think this falls back to how the frontends have graceful fallbacks
Thomas Arildsen
@ThomasA
Nov 21 2014 14:20
Ah, OK. Now I get it.
Kyle Kelley
@rgbkrk
Nov 21 2014 14:20
The kernel returns all output types
The frontend will display whichever is most rich
IIRC
Thomas Arildsen
@ThomasA
Nov 21 2014 14:20
But those are memory addresses that may change from run to run, right?
Kyle Kelley
@rgbkrk
Nov 21 2014 14:20
Yeah
Because its just the repr
Clearly not something for reproducibility
The plot itself should be the same
Assuming same settings, etc.
Thomas Arildsen
@ThomasA
Nov 21 2014 14:23
The trouble is that we are fiddling with some doctest stuff based on IPython notebooks. With these addresses in the output, we cannot compare the output to a previously run instance of the notebook and so, doctest thinks there is an error even though nothing else changed...
Kyle Kelley
@rgbkrk
Nov 21 2014 14:23
Hmmm
Can you ignore those lines or only take a substring?
Thomas Arildsen
@ThomasA
Nov 21 2014 14:26
I'll have to get back to you on that. A couple of other project members are dealing with the doctest stuff...
I am going to have to check out for now. Thanks for the help!
Kyle Kelley
@rgbkrk
Nov 21 2014 14:27
No problem
Lion Krischer
@krischer
Nov 21 2014 14:27
doctests usually use the ELLIPSIS option for precisly that: https://docs.python.org/2/library/doctest.html#doctest.ELLIPSIS
but it will probably be hard to integrate it without pattern matching on memory addresses or something along these lines
Jonathan Frederic
@jdfreder
Nov 21 2014 18:24
Ok, I'm going to redo the pager PR like we talked about in the meeting. Is there any large DOM / layout PRs laying around that I should wait for @minrk @takluyver @Carreau ?
Thomas Kluyver
@takluyver
Nov 21 2014 18:25
not that I'm aware of
Min RK
@minrk
Nov 21 2014 19:41
I don't think so. The main big js PR right now is the keyboard events, but that isn't DOMy
Jonathan Frederic
@jdfreder
Nov 21 2014 19:42
If there a convenience command to run less ? Looks like the fab file was removed
ahh it's a git hook now
Jonathan Frederic
@jdfreder
Nov 21 2014 19:49
ahh nvm
ipython/ipython#6711
Min RK
@minrk
Nov 21 2014 19:56
setup.py css
same as it has always been
fabfile's replaced by invoke (tasks.py), since fabric is largely deprecated, Python 2 only, and has big ssh dependencies since it's mainly for remote execution.