These are chat archives for ipython/ipython

20th
Aug 2015
mohammadreza91
@mohammadreza91
Aug 20 2015 06:01
hi
is there anybody?!
Aaron Meurer
@asmeurer
Aug 20 2015 06:53
https://ipython.org/ipython-doc/dev/config/extensions/#writing-extensions says that extensions have to manage being loaded twice
but when I call %load_ext twice IPython tells me that the extension is already loaded
and %reload_ext apparently does a full module reload, making it impossible to check if it is already loaded (at least without some hackery)
I’m guessing the docs are wrong here
Matthias Bussonnier
@Carreau
Aug 20 2015 07:07
Yes docs wrong, and wrong URL, we shoudl get this one down.
Aaron Meurer
@asmeurer
Aug 20 2015 07:09
you should add redirects or something. I got that from Google.
Matthias Bussonnier
@Carreau
Aug 20 2015 07:13
Yeah, probably. Not sure how we want to do that.
You can add redirect on GH pages ?
(like in meta tags ?)
are there docs on how to setup a fake IPython session for a unit test?
or a simple example I can copy?
Matthias Bussonnier
@Carreau
Aug 20 2015 07:19
Hum... no I would grep through our tests.
To test what ?
using nose ?
Aaron Meurer
@asmeurer
Aug 20 2015 07:21
I just want a to simulate a simple REPL
Matthias Bussonnier
@Carreau
Aug 20 2015 07:21
I would use a remote kernel and send execute requests.
and get execute reply.
Aaron Meurer
@asmeurer
Aug 20 2015 07:21
it needs to be a terminal shell
Matthias Bussonnier
@Carreau
Aug 20 2015 07:21
Hum...
IPython/testing/ipyunittest.py
should help.
Aaron Meurer
@asmeurer
Aug 20 2015 07:24
I’ll take a look
I am writing an extension that customizes the prompt. I just want to write a test that makes sure it doesn’t crash
so I just need something that emulates “run this input, then this input, then this input”, but actually renders all the prompts and output and everything
Matthias Bussonnier
@Carreau
Aug 20 2015 07:30
Hum, not sure how, that's not the part I touch often.
subprocess.Popen ?
I not een sure we have tests for prompts
Aaron Meurer
@asmeurer
Aug 20 2015 07:33
you do have tests for prompts, but I want something a little higher level
Matthias Bussonnier
@Carreau
Aug 20 2015 07:33
And i'm not sure we have. The closer I can think of is DocTest.
Aaron Meurer
@asmeurer
Aug 20 2015 07:33
although Popen may not be a bad idea. then I can just test the output text exactly
Matthias Bussonnier
@Carreau
Aug 20 2015 07:34
Write on ML Min or Fernando Might know when they are awake.
Aaron Meurer
@asmeurer
Aug 20 2015 07:34
yeah I’ll check back during the day
I need to go to bed anyway :)
Matthias Bussonnier
@Carreau
Aug 20 2015 07:34
I think there use to be "demo-mode"
which is what you are looking for.
in IPython/lib/demo.
mohammadreza91
@mohammadreza91
Aug 20 2015 08:28
i need to draw a diagram according to following equation:
f(s)=(sigma from n=1 to n=18) c(n)/(s-a(n))
which book can help me to receive answer?!
Matthias Bussonnier
@Carreau
Aug 20 2015 08:30
@mohammadreza91 that seem like an unrelated question to this channel.
also you don't define your notation, like c(), and a().
assuming you are using python you can plot using http://matplotlib.org/
mohammadreza91
@mohammadreza91
Aug 20 2015 08:32
yeah dear @Carreau . the channel is unrelated. after sending message i understood this point.
thanks for your guide
Matthias Bussonnier
@Carreau
Aug 20 2015 08:33
ok. Where did you found the link to this channel BTW ?
mohammadreza91
@mohammadreza91
Aug 20 2015 08:34
i just googled advanced mathmatics+ipython
Matthias Bussonnier
@Carreau
Aug 20 2015 08:35
ok
thanks.
mohammadreza91
@mohammadreza91
Aug 20 2015 08:35
;-)
Matthias Bussonnier
@Carreau
Aug 20 2015 08:35
have a look at SymPy too.
mohammadreza91
@mohammadreza91
Aug 20 2015 08:36
ok. thank you.
Scott Sanderson
@ssanderson
Aug 20 2015 18:59
is there a supported way to do rich representations for raised exceptions?
I imagine that patching sys.excepthook and calling IPython.display should work
but there already machinery in place for rich exceptions?
if not, I'd be curious to hear people's thoughts on whether that's a desired feature
Kyle Kelley
@rgbkrk
Aug 20 2015 19:19
Well there's a neat idea
The exceptions are one of the most awkward parts of the message spec, imo
We end up having to convert them anyway
It's too bad it's not using the display protocol
because then text/html could either be the ANSI -> HTML conversion or something more rich
I would make my libraries return 'image/png' of a grumpy cat
Scott Sanderson
@ssanderson
Aug 20 2015 19:22
yeah, I want to do things like include links to relevant documentation when users hit errors
@llllllllll ^^
it looks like there's some very old code in InteractiveShell that allows you to call set_custom_exc and register exception handlers
I think parts of that were written before the messagespec even existed
Kyle Kelley
@rgbkrk
Aug 20 2015 19:25
That would make sense since it was all console based before the notebook or qtconsole
Scott Sanderson
@ssanderson
Aug 20 2015 19:25
I could imagine doing cool things with _repr_javascript in exceptions as well
for things like collapseable tracebacks
Evan Bolyen
@ebolyen
Aug 20 2015 19:33
Hey sorry if this is the wrong room. I am trying to build a custom widget (this will be the second one I have attempted), and I can't get the .css method (or even plain DOM API) to work on the attached DOM element unless I put it in a timeout. Is there some mechanism that is stripping styling while the notebook renders?
It is the most baffling thing I have ever seen.
Evan Bolyen
@ebolyen
Aug 20 2015 19:52
Ok, it looks like styles are discarded from this.$el of the View inside render. I have a workaround now at least.
AJ Friend
@ajfriend
Aug 20 2015 20:08

Is anyone else having trouble defining latex macros in markdown cells in ipython/jupyter after the upgrade to 4.0.0?

For example, something like

$$
\newcommand{\reals}{{\mbox{\bf R}}}
$$

Let $x \in \reals^n$

worked fine before the upgrade, but it no longer seems to parse the macro definition correctly.

Matthias Bussonnier
@Carreau
Aug 20 2015 20:32
@ssanderson run this topic on ML, IIRC Thomas have ideas.
epifanio
@epifanio
Aug 20 2015 22:09
Hi
can you please help me to understand how __repr_html__ works ? I’m trying with the following code : http://nbviewer.ipython.org/gist/epifanio/0c1cbb2d4cd74aa2b6a1/html_repr.ipynb
i want : htmldict().makemydict() to return the html representation of a dictionary … but I’m not able to have it working
epifanio
@epifanio
Aug 20 2015 22:20
my bad … same link, new code. now works
Stefan van der Walt
@stefanv
Aug 20 2015 23:00
I'm helping some folks install both python 2 and 3 kernels under Jupyter. I thought it should be as simple as "jupyter kernelspec install-self", which used to work, but no longer does. I tried "jupyter kernelspec install", which the usage doc claims needs no argument, but I get: No source directory specified.. Any advice?
I guess, really, it should be ipython kernelspec install, but I'm quite confused as to the distinction at the moment. When I install ipython, I still get ipython notebook, which I imagine should have become jupyter notebook.
Jason Grout
@jasongrout
Aug 20 2015 23:06
ipython kernelspec install-self
huh, the docs list that as deprecated
jupyter kernelspec install-self works, but jupyter kernelspec -h also shows the same docs (that install-self is deprecated)
I think ipython kernelspec install-self should print out a message saying it's deprecated (if it really is), and how to install the current kernel
I'm confused too by the messaging.
Stefan van der Walt
@stefanv
Aug 20 2015 23:39
jupyter kernelspec install-self does not work for me: [Errno 13] Permission denied: '/usr/local/share/jupyter'
It's running from a virtual environment, so it should not be messing around in /usr/local/share!