These are chat archives for ipython/ipython

4th
Mar 2015
Kester Tong
@KesterTong
Mar 04 2015 03:48
Hey everyone, I just uploaded some experiments with ReactJS to https://github.com/KesterTong/reactnb
it looks like a notebook, you can add and delete code cells, but apart from that it doesn't do anything.
Kester Tong
@KesterTong
Mar 04 2015 03:56
Regarding the dev meeting, I'll be there Monday to Wednesday morning
Younggun Kim
@scari
Mar 04 2015 04:47
Have any sprint plan this pycon?
Min RK
@minrk
Mar 04 2015 05:31
No sprint plans. Only a couple of IPython folks will be at PyCon.
Scott Sanderson
@ssanderson
Mar 04 2015 05:42
I think there's a tutorial though?
Min RK
@minrk
Mar 04 2015 05:58
yup
Stephan Hoyer
@shoyer
Mar 04 2015 06:21
quick ipython 3 question — where can I edit the keyMap used for code mirror? I seem to recall seeing an option somewhere
Jessica B. Hamrick
@jhamrick
Mar 04 2015 06:24
In my custom.js, I modify the keyMap like this:
require(
    ['notebook/js/cell'],
    function (cell) {
        cell.Cell.options_default.cm_config.theme = 'ipython';
        cell.Cell.options_default.cm_config.extraKeys['Ctrl-Left'] = 'goGroupLeft';
        cell.Cell.options_default.cm_config.extraKeys['Ctrl-Right'] = 'goGroupRight';
        cell.Cell.options_default.cm_config.extraKeys['Cmd-Backspace'] = 'delGroupBefore';
        cell.Cell.options_default.cm_config.extraKeys['Cmd-;'] = 'toggleComment';
    }
);
I am not sure if that is the expected way to do it, though; I also made that customization a while ago so don’t remember if e.g. setting the theme is actually necessary?
Stephan Hoyer
@shoyer
Mar 04 2015 06:25
I read there is some way to enable sublime text shortcuts
presumably related to this: http://codemirror.net/demo/sublime.html
well, someone will probably answer me on twitter: https://twitter.com/ProjectJupyter/status/572996330353639424
Jessica B. Hamrick
@jhamrick
Mar 04 2015 06:28
I used to have the emacs text shortcuts enabled, let me find how I had done that
require([
    'base/js/namespace',
    'custom/emacs'
], function (IPython, CodeMirror) {
    CodeMirror.defaults.keyMap = 'emacs';
    CodeMirror.defaults.theme = 'ipython';
    CodeMirror.keyMap["emacs-Ctrl-X"]["Ctrl-S"] = function (cm) {
        IPython.notebook.save_checkpoint();
    };
    CodeMirror.keyMap["emacs-Ctrl-X"]["S"] = function (cm) {
        IPython.notebook.save_checkpoint();
    };
});
Where custom/emacs refers to emacs.js that I added to my custom folder
The equivalent would be the sublime.js from that link you posted
Stephan Hoyer
@shoyer
Mar 04 2015 06:30
nice, I’ll give that a try
Jonathan Frederic
@jdfreder
Mar 04 2015 16:11
@kestertong cool ReactJS demo
Kester Tong
@KesterTong
Mar 04 2015 16:57
@sccolbert @jasongrout I'm unfamiliar with Phosphor. Can you tell me a bit about its background and community? And were you in particular considering using Phosphor for IPython widgets (or does Phosphor already have some relationships to IPython widgets)?
@jdfreder Thanks
S. Chris Colbert
@sccolbert
Mar 04 2015 17:06
@KesterTong I wrote Phosphor because I was unsatisfied with the state of UI development on the web. As mentioned in the meeting yesterday, Phosphor is a widget toolkit like Qt or GTK, but it doesn't attempt to be monolithic like those libraries. It provides good implementations of the widgets which are hard to get right (splitters, dock areas, menus, nested layouts) and a virtual DOM implementation (like React) for everything else. It's also quite flexible, and easily integrates with other JS libraries. For example, wrapping CodeMirror in Phosphor is about two dozen lines of code: https://github.com/phosphorjs/phosphor-ui/blob/master/src/codemirrorwidget.ts
In my testing, Phosphor's virtual DOM implementation is ~2.5x faster than React
Kester Tong
@KesterTong
Mar 04 2015 17:09
@sccolbert Thanks. And right now, are any IPython widgets using Phosphor?
Jason Grout
@jasongrout
Mar 04 2015 17:09
no
S. Chris Colbert
@sccolbert
Mar 04 2015 17:09
@KesterTong no - and I'm not aware of any plans to change that, given how much existing widget code there already is.
@KesterTong - Phosphor really shines when you use it as the scaffolding to build large applications - think analytics environments which host notebooks, editors, file browsers, and a host of other tools
Kester Tong
@KesterTong
Mar 04 2015 17:10
@sccolbert Ok thanks, I just wanted to be sure.
@sccolbert are there any projects you're aware of using Phosphor I can look at?
Jason Grout
@jasongrout
Mar 04 2015 17:11
as for community, I don't know of any open-source projects using phosphor. So that's a +1 for React
S. Chris Colbert
@sccolbert
Mar 04 2015 17:11
@KesterTong none that are public
(as of yet)
Jason Grout
@jasongrout
Mar 04 2015 17:11
to be fair, Chris, is just finishing (as much as you can say software is 'finished') phosphor
(or at least an initial version of phosphor)
You could have a react component inside of phosphor, though; it's not a completely mutually exclusive choice
Chris mentioned to me the other day some things he thought were problems in React's design, though. it might make more sense to discuss things like this next week.
S. Chris Colbert
@sccolbert
Mar 04 2015 17:13
^ +1 - Phosphor is unopinionated when it comes to embedding foreign content
Kester Tong
@KesterTong
Mar 04 2015 17:15
@jasongrout sure, you will and @sccolbert be there Monday and Tuesday right?
Jason Grout
@jasongrout
Mar 04 2015 17:16
Yes
we'll be there Monday afternoon - flight gets in late morning.
and Tuesday
and we can also continue the conversation in NY the next week when Brian comes out
@kesterTong, when are your flights? We might be on the same flight at some point too.
Kester Tong
@KesterTong
Mar 04 2015 17:21
haven't book them yet
Sylvain Corlay
@SylvainCorlay
Mar 04 2015 17:21
we have the 8am AA flight
Kester Tong
@KesterTong
Mar 04 2015 17:21
what are yours?
ok I'll probably leave Saturday
and Wednesday evening/afternoon
S. Chris Colbert
@sccolbert
Mar 04 2015 17:22
probably want to take explicit flight details to an offline conversation
just a thought
Jason Grout
@jasongrout
Mar 04 2015 17:22
(I just did... :)
Thomas Kluyver
@takluyver
Mar 04 2015 17:27
Do we have writeup somewhere of our 'no cleanup PRs' policy to link people to?
andrea
@elforza
Mar 04 2015 17:27
Hello there. First timer here. Is this the right place to ask a question about statistics and data sampling and the like? Sorry if not, please let me know where I should direct my question..
[using python o f course]...
Thomas Kluyver
@takluyver
Mar 04 2015 17:29
Hi @elforza . Not really, this is for questions specifically about the IPython interface
andrea
@elforza
Mar 04 2015 17:29
ah... numpy is it then.... Thanks! sorry for the intrusion!
bye bye
Thomas Kluyver
@takluyver
Mar 04 2015 17:29
I might try the scipy-user mailing list
no problem
Jonathan Frederic
@jdfreder
Mar 04 2015 18:16
@takluyver I think we have that in our IPython Developer guide
or at least mention it... If not we should.
Additionally we could add a small tidbit to the README.md
so it shows on the repo page.
Thomas Kluyver
@takluyver
Mar 04 2015 18:18
I've added it to CONTRIBUTING.md at Min's suggestion
Jonathan Frederic
@jdfreder
Mar 04 2015 18:18
Ah ok
Was there another big "clean-up" PR?
I sense a disruption in the force.
Thomas Kluyver
@takluyver
Mar 04 2015 18:20
yeah, #7961
Joris Van den Bossche
@jorisvandenbossche
Mar 04 2015 19:47
@takluyver I was looking again at #7943
And it seems that it was the copy-paste (nb-cccp) extension that caused the notebook not to load/connect
Thomas Kluyver
@takluyver
Mar 04 2015 19:54
ah, someone else reported an issue about that as well
I guess it makes sense, that digs deeper into the notebook than most extensions
Sylvain Corlay
@SylvainCorlay
Mar 04 2015 21:50
hello @jdfreder do you guys have any plan to get back in the business of iframe widget-area
K.-Michael Aye
@michaelaye
Mar 04 2015 21:51
i noticed that on a slow computer i can ‘execute’ a cell before the kernel is connected. so the next cell becomes active, making the user believe that the previous cell has been executed while it’s not. maybe this could be caught somehow?
Jonathan Frederic
@jdfreder
Mar 04 2015 21:56
@SylvainCorlay yes, definitely!
Post Big Split(tm)
Min RK
@minrk
Mar 04 2015 21:57
Yup, probably a 5.0 thing
Sylvain Corlay
@SylvainCorlay
Mar 04 2015 22:01
I would have shared a JCVdM video for the big split(tm) but it is unnecessary I think
Fernando Perez
@fperez
Mar 04 2015 22:14
I guess we have an official theme video! And the actual job is probably going to be just about as hard to pull off as this stunt, I'm afraid.
Jason Grout
@jasongrout
Mar 04 2015 23:24
@minrk, have you thought about setting the Allow-Access-Control-Origin header on the api to allow requests from cross-origin javascript?
Something like this:
diff --git a/IPython/html/services/contents/handlers.py b/IPython/html/services/contents/handlers.py
index 1e8bd33..c4496fb 100644
--- a/IPython/html/services/contents/handlers.py
+++ b/IPython/html/services/contents/handlers.py
@@ -98,6 +98,7 @@ def _finish_model(self, model, location=True):
             self.set_header('Location', location)
         self.set_header('Last-Modified', model['last_modified'])
         self.set_header('Content-Type', 'application/json')
+        self.set_header('Access-Control-Allow-Origin', '*')
         self.finish(json.dumps(model, default=date_default))

     @web.authenticated
Min RK
@minrk
Mar 04 2015 23:25
We disallowed that on purpose
Jason Grout
@jasongrout
Mar 04 2015 23:26
is the security concern that you don't want js on a page to be able to load and explore all of your files, delete everything, etc.?
(be right back...)
Min RK
@minrk
Mar 04 2015 23:26
you can change it via config, but we shouldn't allow it by default.
yes, it is a massive security problem to allow it in the default inauthenticated circumstance.
It may be appropriate to use a different value, assuming notebooks are hosted on some service, and always authenticated.
But never for localhost