These are chat archives for ipython/ipython

15th
Dec 2014
Spencer Boucher
@justmytwospence
Dec 15 2014 07:12
If I am instantiating a KernelManager, how can it be set up to read the configuration profile_default configuration?
Jason Grout
@jasongrout
Dec 15 2014 17:06
@carreau? I have a question about toolbar.js
Matthias Bussonnier
@Carreau
Dec 15 2014 17:07
Yes ?
Jason Grout
@jasongrout
Dec 15 2014 17:07
I'm looking at the ToolBar.prototype.construct function (it's giving us errors)
sorry, the add_buttons_group is giving errors.
I'm just trying to understand what exactly the config parameter to the ToolBar.prototype.construct function is
Matthias Bussonnier
@Carreau
Dec 15 2014 17:07
Hum, I refactored it recently ...
Jason Grout
@jasongrout
Dec 15 2014 17:07
on line 30 of toolbar.js
the error is that for(var k in config) doesn't work to iterate through arrays when someone has modified the Array prototype, I think because you get all the keys
Matthias Bussonnier
@Carreau
Dec 15 2014 17:08
so it can be @ things.
Jason Grout
@jasongrout
Dec 15 2014 17:08
but I'm trying to understand this code:
        for(var k in config){
            this.add_buttons_group(config[k][0],k[1]);
        }
2 things?
Matthias Bussonnier
@Carreau
Dec 15 2014 17:09
either a list of list of dict (old way)
     * [
     *          {
     *            label:'my button',
     *            icon:'icon-hdd',
     *            callback:function(){alert('hoho')},
     *            id : 'my_button_id',    // this is optional
     *          },
     *          {
     *            label:'my second button',
     *            icon:'icon-play',
     *            callback:function(){alert('be carefull I cut')}
     *          }
     *        ]
So you register callback directly.
Jason Grout
@jasongrout
Dec 15 2014 17:10
that's a list of dict
Matthias Bussonnier
@Carreau
Dec 15 2014 17:11
a list of these.
Jason Grout
@jasongrout
Dec 15 2014 17:11
so in that case, k should be a numeric index into the outside list, and config[k] should be one of those things?
Matthias Bussonnier
@Carreau
Dec 15 2014 17:11
each group of the first level list will make a group of button
each element in sublist, will make a button
(last element beein the optional name of the button group)
each button is a dict
yep
or, new way
var grps = [
          [
            ['ipython.save-notebook'],
            'save-notbook'
          ],
          [
            ['ipython.insert-cell-after'],
            'insert_above_below'],
          [
            ['ipython.cut-selected-cell',
             'ipython.copy-selected-cell',
             'ipython.paste-cell-after'
            ] ,
            'cut_copy_paste'],
          [
            ['ipython.move-selected-cell-up',
             'ipython.move-selected-cell-down'
            ],
            'move_up_down'],
          [ ['ipython.run-select-next',
             'ipython.interrupt-kernel',
             'ipython.restart-kernel'
            ],
            'run_int'],
         ['<add_celltype_list>'],
         ['<add_celltoolbar_list>']
        ];
        this.construct(grps);
Jason Grout
@jasongrout
Dec 15 2014 17:12
wait...
Matthias Bussonnier
@Carreau
Dec 15 2014 17:13
where the <things> are private
Jason Grout
@jasongrout
Dec 15 2014 17:13
config[k][0] then is the first button listed, and k[1] is undefined (in the old way)
Matthias Bussonnier
@Carreau
Dec 15 2014 17:15
wait... let me fetch the old doc I migh have forgotten one level of list.
Jason Grout
@jasongrout
Dec 15 2014 17:15
I submit that this is evidence that the code should be restructured :)
Matthias Bussonnier
@Carreau
Dec 15 2014 17:15
Yessss I knowwww...
 IPython.toolbar.add_buttons_group([
        {
             'label'   : 'run qtconsole',
             'icon'    : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
             'callback': function () {
                 IPython.notebook.kernel.execute('%qtconsole')
             }
        }
        // add more button here if needed.
        ]);
sum up in
add([list of button], 'group_id')
Jason Grout
@jasongrout
Dec 15 2014 17:18
config[k][0] indicates k is an index, while k[1] indicates k is an array
that's what is really confusing to me.
Matthias Bussonnier
@Carreau
Dec 15 2014 17:19
yeah, but array are dict indexed bynumber
Jason Grout
@jasongrout
Dec 15 2014 17:19
so what is k supposed to be?
in the old way and the new way?
Matthias Bussonnier
@Carreau
Dec 15 2014 17:20
in the new way you can found out in maintoolbar.
Jason Grout
@jasongrout
Dec 15 2014 17:20
(I submit we should have clean codepaths depending on the type of config, if we are support two different types of config arguments)
Matthias Bussonnier
@Carreau
Dec 15 2014 17:22
Ok, so here is the PR
So no old ways..
was just a methods without params
Jason Grout
@jasongrout
Dec 15 2014 17:22
it looks like those three lines should be, for the new way:
        for(var k in config){
            this.add_buttons_group(config[k][0],config[k][1]);
        }
(notice the second argument is now config[k][1]
and the for loop should be:
for(var k = 0; k < config.length; k++) { ... }
Matthias Bussonnier
@Carreau
Dec 15 2014 17:24
yeah, might be that
as the second arg is optional is passed through
Jason Grout
@jasongrout
Dec 15 2014 17:25
so how does the new way give the label, icon, callback, etc?
it looks like it is just giving a string
for each button
Matthias Bussonnier
@Carreau
Dec 15 2014 17:26
see ipython/ipython#6668
you register an action that has name, icon calback...etc
it's not finished but in the end you will be able to bind menu, toolbar and keyboard to the same action
and the menu shoudl show the keyboard shortcut.
the goal is to have a purely delarative config
The actions of course need a callback which is JS, but the use config (which shortcut does what, ... ) could be json
does that make "some" sens ?
Jason Grout
@jasongrout
Dec 15 2014 17:30
yes, I think I see the goal. Is there a simple set of steps to convert from the old way of creating a menubar button to using the new system?
Matthias Bussonnier
@Carreau
Dec 15 2014 17:30
I'll do an ex 5 min
Jason Grout
@jasongrout
Dec 15 2014 17:31
awesome; thanks!
I'll submit a quick pr with the changes to the toolbar code
Matthias Bussonnier
@Carreau
Dec 15 2014 17:43
Wait, my chrome is doing shit dn't want to stop in debugger.
hopefully:
var name = IPython.notebook.keyboard_manager.actions.register(
{
    handler:function(){console.log('hi there')},
    help:'say hello in console',
    icon:'fa fa-comments-o'

},
'say-hey','custom')
IPython.keyboard_manager.command_shortcuts.add_shortcut('Ctrl-G',name)
IPython.toolbar.add_buttons_group([name])
but IPython.notebook.keyboard_manager.actions.register calls IPython.notebook.keyboard_manager.actions.normilise which is doing things wron and set an empty icon
but the button appear and works
Matthias Bussonnier
@Carreau
Dec 15 2014 17:49
Fixed ! will submit PR
Jason Grout
@jasongrout
Dec 15 2014 17:51
@Carreau - also ipython/ipython#7224, ready for your review
Jason Grout
@jasongrout
Dec 15 2014 18:57
is there something wrong with Travis? https://travis-ci.org/ipython/ipython/builds lists builds finished 2 hours ago, but with no duration
Thomas Kluyver
@takluyver
Dec 15 2014 18:58
looks like those were canceled
Jonathan Frederic
@jdfreder
Dec 15 2014 18:58
Yeah, grey = human canceled
Thomas Kluyver
@takluyver
Dec 15 2014 18:58
or error, I think
Jonathan Frederic
@jdfreder
Dec 15 2014 18:59
Oh, well with these it appears they were canceled
Thomas Kluyver
@takluyver
Dec 15 2014 18:59
yep
we often cancel builds when we know we don't need the result, to help keep Travis running on things we do care about
because it can be slow
Jonathan Frederic
@jdfreder
Dec 15 2014 18:59
Lately it's been very slow
the other day I had to wait 5 hours
for it to run against my branch
Thomas Kluyver
@takluyver
Dec 15 2014 19:00
yeah
Jonathan Frederic
@jdfreder
Dec 15 2014 19:01
@takluyver would our Jenkins server be a viable replacement (just curious)
?
Thomas Kluyver
@takluyver
Dec 15 2014 19:02
I guess we could experiment with that, yes
Jenkins is just big and complex, especially when you want to set up things like pull request integration
Jonathan Frederic
@jdfreder
Dec 15 2014 19:02
I'm guessing we could integrate it with GitHub as nicely as we do with Travis and we'd have the option to also run the Windows tests.
Thomas Kluyver
@takluyver
Dec 15 2014 19:03
we had it working for a while so I could say "Jenkins, test on Windows, please" in a comment, and it would see that and run the Windows tests
but then it broke, and I couldn't work out how to fix it
so now we go to Jenkins and run Windows PR tests by giving it the PR number
sometimes I wonder if buildbot would be a better option
my impression is that buildbot is big and complex, but it's Linux-style complexity with text config files and things, whereas Jenkins is all about plugins and lousy web UIs
buildbot is also Python, IIRC, so if we needed to improve extensions, we could do so easier than with Jenkins, which is Java
Jonathan Frederic
@jdfreder
Dec 15 2014 19:06
Java :skull:
Brian E. Granger
@ellisonbg
Dec 15 2014 19:06
Bleh :(
Thomas Kluyver
@takluyver
Dec 15 2014 19:06
yeah
it does have some things going for it - like it's very easy to attach a Windows slave, using the Java web start thingy - but there's a whole lot of wtf in there too
Jason Grout
@jasongrout
Dec 15 2014 19:10
ah, I figured that @Carreau wouldn't merge ipython/ipython#7224 until Travis okays it. But it's canceled?
Jonathan Frederic
@jdfreder
Dec 15 2014 19:21
@jasongrout he may be asleep, it's late in France.
Min RK
@minrk
Dec 15 2014 19:22
Travis is backed up
it's not canceled, it's just in the queue
Thomas Kluyver
@takluyver
Dec 15 2014 19:26
Min's take on buildbot vs Jenkins: "probably less frustrating work, but more work"
Jonathan Frederic
@jdfreder
Dec 15 2014 19:27
+1 for more less frustrating work :)
Brian E. Granger
@ellisonbg
Dec 15 2014 19:27
+2 for ponies though :horse:
Jonathan Frederic
@jdfreder
Dec 15 2014 19:27
+INT_MAX for not 5 hour Travis waiting times
(4 byte int)
Thomas Kluyver
@takluyver
Dec 15 2014 19:28
+1 for not messing around with CI infrastructure until 3.0 is sorted ;-)
Brian E. Granger
@ellisonbg
Dec 15 2014 19:28
Yes, with that we might as well reimplement everthing in C so we can wait to compile everything
Min RK
@minrk
Dec 15 2014 19:28
@jdfreder are you volunteering to deploy a buildbot setup that automatically tests PRs?
Thomas Kluyver
@takluyver
Dec 15 2014 19:28
(ponies later :horse: )
Brian E. Granger
@ellisonbg
Dec 15 2014 19:28
OK
Min RK
@minrk
Dec 15 2014 19:28
@ellisonbg don't be ridiculous, it would obviously be a combination of Go and Rust
Thomas Kluyver
@takluyver
Dec 15 2014 19:29
we'd call it Gost
Brian E. Granger
@ellisonbg
Dec 15 2014 19:29
I am fine with that, just as long as there are long compilations time to go and get :coffee:
Thomas Kluyver
@takluyver
Dec 15 2014 19:29
and then fight off all those JS testing projects
Jonathan Frederic
@jdfreder
Dec 15 2014 19:30
@minrk Don't forget RANT
I'll use it to make the result messages more interesting
@takluyver if we want to fight off the JS testing projects, we should call ours "GhostBuster".
Brian E. Granger
@ellisonbg
Dec 15 2014 19:31
Perfect
Thomas Kluyver
@takluyver
Dec 15 2014 19:37
he
hh
Jonathan Frederic
@jdfreder
Dec 15 2014 19:42
@/all we should contact Travis to see if there is a way that we could have IP builds prioritized.
We could even pay them...
it's intended for private repos, but I think you could use it to buy priority too
but $130/month for 2 concurrent jobs doesn't sound that great
given that every push is five jobs trying to run concurrently
Min RK
@minrk
Dec 15 2014 19:45
And we have access to hardware
After 3.0, it probably makes sense to look into rolling our own
Thomas Kluyver
@takluyver
Dec 15 2014 19:46
yeah, if Travis doesn't do anything to speed things up, I think that makes sense
Matthias Bussonnier
@Carreau
Dec 15 2014 19:47
well, during the day in france, Travis is fast.
I have almost all my buildimmediately.
Thomas Kluyver
@takluyver
Dec 15 2014 19:47
we should all move to France! ;-)
Matthias Bussonnier
@Carreau
Dec 15 2014 19:47
:-P
and @jdfreder I wad just having dinner :-)
Thomas Kluyver
@takluyver
Dec 15 2014 19:48
@jdfreder I'll make you a Jenkins account, feel free to fiddle with it. In principle, it's perfectly possible to get it set up testing pull requests automatically and everything.
Matthias Bussonnier
@Carreau
Dec 15 2014 19:48
question for @rgbkrk , build machines can be "sponsored" by companie, would rackspace sponsor a travis worker for python only ?
Scott Sanderson
@ssanderson
Dec 15 2014 21:16
@minrk I've got the test_contents_api tests running now with my replacement manager, but I haven't figured out a way to thread additional config values through to the instance
so far the body of my test subclass is:
from IPython.html.services.contents.tests.test_contents_api import APITest

class PGContentsAPITest(APITest):

    config = Config()
    config.NotebookApp.contents_manager_class = PostgresContentsManager
    config.NotebookApp.ContentsManager.user_id = 'test'
the first one is taking, but the second isn't
Matthias Bussonnier
@Carreau
Dec 15 2014 21:27
@ssanderson config.ContentsManager.user_id = 'test' should be enough.
asuming user_id is a configurable.
Scott Sanderson
@ssanderson
Dec 15 2014 21:28
it is on my subclass, not on the base class
I'll try that though
no dice
Matthias Bussonnier
@Carreau
Dec 15 2014 21:30
config.ContentsManager.user_id = 'test' will apply to any subclass of ContentsManager, otherwise just use config.YourClassName.your_property_name = your_value
Scott Sanderson
@ssanderson
Dec 15 2014 21:31
I think the instantiation sequence is more exotic than the normal setup
it's in the setup of a test case
I can hack around it for the time being by monkey-patching the instance at the start of each test, but it feels like there should be a way to get those config values to take
(the diff above is also in a WIP change, so I think modifying config for tests like this might be new science)
Brian E. Granger
@ellisonbg
Dec 15 2014 21:37
@takluyver about the cost of travis - at the same our own time is about $100/hour. So if paying travis even $500/month saves us 5 hours of work it is worth it
I really don't want us to have to mainain another service/system if possible
Kyle Kelley
@rgbkrk
Dec 15 2014 21:59
@Carreau What does handing a dedicated worker to Travis take?
Because that makes complete sense and we have the resources.
It kind of seems like bluebox donates all the infrastructure
Min RK
@minrk
Dec 15 2014 22:02
@ssanderson it should be config.PostgresContentsManager.user_id = 'test'
Jason Grout
@jasongrout
Dec 15 2014 22:11
@Carreau - are you still around?
Scott Sanderson
@ssanderson
Dec 15 2014 22:20
@minrk that doesn't appear to be working.
Min RK
@minrk
Dec 15 2014 22:21
I may need to make some changes to config loading
This is in a subclass of APITest?
Scott Sanderson
@ssanderson
Dec 15 2014 22:22
yeah
the full test is currently:
from IPython.config import Config
from IPython.html.services.contents.tests.test_contents_api import APITest

from ..pgmanager import PostgresContentsManager
from ..schema import create_directory


class PGContentsAPITest(APITest):

    config = Config()
    config.NotebookApp.contents_manager_class = 'pgcontents.pgmanager.PostgresContentsManager'
    config.PostgresContentsManager.user_id = 'test'
I notice that ContentsManager and FileContentsManager are both listed in NotebookApp.classes does that affect this?
Min RK
@minrk
Dec 15 2014 22:24
No, the class list is just used for generating help output
Scott Sanderson
@ssanderson
Dec 15 2014 22:24
ah
Min RK
@minrk
Dec 15 2014 22:26
I'll see if I can figure out what's going on over here
Scott Sanderson
@ssanderson
Dec 15 2014 22:26
much appreciated
Thomas Kluyver
@takluyver
Dec 15 2014 22:29
@ellisonbg my time, much as I may wish otherwise, is not costing the project $100/hour
Min RK
@minrk
Dec 15 2014 22:33
@ssanderson how do I get pg initialized so the test will run?
I have OperationalError: (OperationalError) FATAL: database "pgcontents" does not exist
Jonathan Frederic
@jdfreder
Dec 15 2014 22:34
hehe @takluyver ditto
Scott Sanderson
@ssanderson
Dec 15 2014 22:39
@minrk I'm assuming you already have postgres installed?
Min RK
@minrk
Dec 15 2014 22:39
I do, it connects, just says db doesn't exist
Scott Sanderson
@ssanderson
Dec 15 2014 22:40
in psql, do CREATE DATABASE pgcontents;
and then you're going to want to run the initial schema migration with alembic upgrade head from the directory containing alembic.ini
you
you'll have to edit the url in alembic.ini too to something like postgresql://minrk@/pgcontents
if that works then if you do \d in psql you should see something like:
pgcontents=# \d
                 List of relations
 Schema |       Name       |   Type   |   Owner
--------+------------------+----------+------------
 public | alembic_version  | table    | ssanderson
 public | directories      | table    | ssanderson
 public | notebooks        | table    | ssanderson
 public | notebooks_id_seq | sequence | ssanderson
 public | users            | table    | ssanderson
(5 rows)
Min RK
@minrk
Dec 15 2014 22:47
okay, got it running
aha!
I should have looked for this first
only traitlets with config=True can be set by config.
you need to add config=True to your user_id traitlet if it can be configured
Scott Sanderson
@ssanderson
Dec 15 2014 22:49
oh, welp, that makes sense
glad to hear it can run on a machine other than mine though!
Min RK
@minrk
Dec 15 2014 22:51
alembic needed some patches to run, though
Scott Sanderson
@ssanderson
Dec 15 2014 22:52
what else needed changing?
Jonathan Frederic
@jdfreder
Dec 15 2014 22:52
@/all someone merged commit markers in master
Min RK
@minrk
Dec 15 2014 22:52
just some relative imports
Brian E. Granger
@ellisonbg
Dec 15 2014 22:52
houston we have a problem
Screen Shot 2014-12-15 at 2.52.01 PM.png
Min RK
@minrk
Dec 15 2014 22:52
lol, getting a bit enthusiastic about merging
Brian E. Granger
@ellisonbg
Dec 15 2014 22:52
That is a good thing :)
Min RK
@minrk
Dec 15 2014 22:53
um, are you sure? I don't see any in master
What's your git status?
master is 683d70d445
@ssanderson the import schema didn't work due to 'relative import from non-package'
Brian E. Granger
@ellisonbg
Dec 15 2014 22:55
hmm, hold on, I have made a mess
Scott Sanderson
@ssanderson
Dec 15 2014 22:57
@minrk hrm, I wonder why I'm not hitting that
Min RK
@minrk
Dec 15 2014 22:57
Might be an issue of installed vs not installed
Min RK
@minrk
Dec 15 2014 23:02
@ssanderson did you add the from .error recently in schema? Prior to that, it would have imported fine.
Scott Sanderson
@ssanderson
Dec 15 2014 23:06
yeah that was pushed at 2 AM last night...
so I may just not have regenerated the db since then
just tested out your change though and it works for me; and I like being able to do relative imports in the main source so it seems worthwhile to merge
Min RK
@minrk
Dec 15 2014 23:11
Yup, relative imports are nice, so I just added the package itself to path, instead of its contents
Scott Sanderson
@ssanderson
Dec 15 2014 23:13
I suspect that I'll end up having to ship some sort of wrapper around the alembic CLI eventually, since it doesn't (as far as I can tell) support templating values into the initial.ini file
but this'll help in the interim
just merged your PR
Min RK
@minrk
Dec 15 2014 23:17
makes sense
Scott Sanderson
@ssanderson
Dec 15 2014 23:20
setting config=True on the traits worked btw
Min RK
@minrk
Dec 15 2014 23:21
Great
I'll add a better warning when that happens, it shouldn't fail silently