These are chat archives for ipython/ipython

10th
Sep 2014
Thomas Kluyver
@takluyver
Sep 10 2014 00:00
the result does get pushed through the other transformers, but it gets sent as a single piece, not line by line, so the transformer for magics doesn't see anything to transform
Min RK
@minrk
Sep 10 2014 00:01
Is that a bug, then?
it should split lines and pass one at a time if it gets a multi-line block from a transformer?
Thomas Kluyver
@takluyver
Sep 10 2014 00:02
Does it work if you just append it to python_line_transforms instead?
Min RK
@minrk
Sep 10 2014 00:02
let me check
yes
intriguing!
Thomas Kluyver
@takluyver
Sep 10 2014 00:03
that way it runs after the magic transforms happen
Min RK
@minrk
Sep 10 2014 00:03
so there's a bug if I want it to run first
Thomas Kluyver
@takluyver
Sep 10 2014 00:05
hmmm, I'm trying to work out if that is a bug or not. If you start a line with % inside a cell magic, you don't want it to be transformed to get_ipython().magic(...) regardless of what the cell magic is
Min RK
@minrk
Sep 10 2014 00:06
True
So cell magic wants to take it in, and preempt everything else
but what I'm working on wants to go first, but let everything else process the result of its transform as if it were typed normally.
Thomas Kluyver
@takluyver
Sep 10 2014 00:07
I think that wouldn't actually be an issue, though, because the body gets converted to a string repr for cell magic, so newlines become \n
so yes, I think it would be safe to split on newlines after each transformer, and feed the result down the pipeline line-by-line.
Min RK
@minrk
Sep 10 2014 00:11
ok
Do you want to take a stab at that, or shall I? You understand the code better, so you would probably do a quicker/better job. But I would also like to better understand this code, so it might be useful to try to figure out how to do it.
Thomas Kluyver
@takluyver
Sep 10 2014 00:14
I think I can do it fairly quickly, but it's worth having more than one person who understands this code. The relevant method is IPython.core.inputsplitter.IPythonInputSplitter.flush_transformers()
Min RK
@minrk
Sep 10 2014 00:14
I'm on the case!
Thomas Kluyver
@takluyver
Sep 10 2014 00:15
awesome!
Min RK
@minrk
Sep 10 2014 00:55
@takluyver I took a stab in #6443. I'm not sure it's the right way to go, but it seems to work.
Thomas Kluyver
@takluyver
Sep 10 2014 00:57
OK, looking notw
now
Sylvain Corlay
@SylvainCorlay
Sep 10 2014 19:47
@minrk regarding the distinctions between the directories kernels, nbextensions, profile/static, files, I was discussing with @jasongrout on moving some things to nbextensions. However, for example, I have added a codemirror mode for a language for which I have a kernel here. It seems that this would need to be in profile/static so that I can overload whatever is in IPython/html/static - or is there a better practice?
Min RK
@minrk
Sep 10 2014 19:48
I should have clarified - the static dir is only for clobbering files that are already served as part of IPython's source (e.g. replacing a codemirror mode)
no new files should go in there
Though I suspect that it might still preferable to put new codemirror modes in nbextensions, and load them explicitly, rather than clobbering existing ones
Sylvain Corlay
@SylvainCorlay
Sep 10 2014 19:49
Yeah it is a new mode