These are chat archives for ipython/ipython

3rd
Nov 2014
Jonathan Frederic
@jdfreder
Nov 03 2014 16:44

@jasongrout how do you feel about wrapping errors? I really miss that feature of the .net language family.

try
    raise new Exception('error1')
catch e as Exception
    raise new IOException(e)
end try

for Javascript we could do something like

new Error({msg: 'Higher level message.', original: error});

where error is a lower level Error.

I looked online for a JS intrinsic way of doing this, but couldn't find anything. I think using an object in the Error's message to contain both the new message and the original error could work, but I'm not convinced it's obvious enough that it should be a practice we partake in...
I copied the question to ipython/ipython#6818
Thomas Kluyver
@takluyver
Nov 03 2014 16:55
Our plan for today is to get nbformat 4 (#6045) landed. If you know of any reason why these two branches should not be joined in holy merging, speak now or forever hold your peace.
Jonathan Frederic
@jdfreder
Nov 03 2014 16:56
LOL
I'm +1 for nbformat 4
Thomas Kluyver
@takluyver
Nov 03 2014 16:56
excellent
Jonathan Frederic
@jdfreder
Nov 03 2014 16:56
I don't think anyone else is online right now though
but it was posted in the PR on Friday that today was the day
so that's plenty of notice
Thomas Kluyver
@takluyver
Nov 03 2014 16:57
yep :) I just thought I'd give people another heads up here.
I'll wait for Min to get in, though
Jonathan Frederic
@jdfreder
Nov 03 2014 16:58
good idea
he'll enjoy that
Jonathan Frederic
@jdfreder
Nov 03 2014 17:15
Interesting, for those of us wondering about properties in Javascript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
Thomas Kluyver
@takluyver
Nov 03 2014 17:21
hmm, that is interesting
Jonathan Frederic
@jdfreder
Nov 03 2014 17:22
Yeah
makes me wonder if backbone & our widget model could be done in a way that's more symmetric syntactically to the Python side

so something like Python

w.x = 3

could look like this in Javascript

w.x = 3;
instead of
w.set('x', 3);
brb going to head to campus
Jason Grout
@jasongrout
Nov 03 2014 17:38
My guess is that backbone itself may start using properties at some point
@jdfreder - I don't have any feelings for wrapping errors.
I do know that I get frustrated when a stack trace to the right place doesn't appear in the javascript console
Thomas Kluyver
@takluyver
Nov 03 2014 17:55
OK, we're about to land nbformat 4 - any last minute objections before we do?
and it's done!
:cake:
Matthias Bussonnier
@Carreau
Nov 03 2014 18:09
@jdfreder Hum, really interesting.
could use that for google drive !
Jonathan Frederic
@jdfreder
Nov 03 2014 18:18
:cake: !
Matthias Bussonnier
@Carreau
Nov 03 2014 18:23
the cake is a lie
Thomas Kluyver
@takluyver
Nov 03 2014 18:24
only cause there's no icon for cinnamon bun
;-)
Jonathan Frederic
@jdfreder
Nov 03 2014 18:25
@Carreau you must have not completed Portal, the cake exists at the end of the game.
Thomas Kluyver
@takluyver
Nov 03 2014 18:45
I'm also hoping we can get #6783 in today
Jonathan Frederic
@jdfreder
Nov 03 2014 18:52
@takluyver pausing what I'm doing to take a look...
Thomas Kluyver
@takluyver
Nov 03 2014 18:52
thanks!
Brian E. Granger
@ellisonbg
Nov 03 2014 20:06
@/all The nature demo goes live on Wed. I am working with Kyle and the Nature folks today on finishing things up. I am wondering what the best domain for this is. Right now Kyle has this at nature.tmpnb.org. But I think we all agreed that tmpnb.org wasn't the best domain for this. Do we want to move it over the jupyter or jovyan?
Thomas Kluyver
@takluyver
Nov 03 2014 20:07
naturedemo.jupyter.org?
Brian E. Granger
@ellisonbg
Nov 03 2014 20:08
I think using our main domain jupyter is a decent idea because it doesn't suggest to the public that tmpnb.org is a thing
It also emphasizes that this demo is a real jupyter/ipython thing
Thomas Kluyver
@takluyver
Nov 03 2014 20:09
yep
Brian E. Granger
@ellisonbg
Nov 03 2014 20:09
Thanks I will run that by Kyle and the nature folks
Thomas Kluyver
@takluyver
Nov 03 2014 20:09
though from what I understand of cookies, if we ever want to have any authentication on jupyter.org, we will need to move user content to another domain
but there are always redirectrs
Brian E. Granger
@ellisonbg
Nov 03 2014 20:10
Yep - and the naturedemo is only going to be live for a few months
The longer term hosted nb stuff can be somewhere different
Thomas Kluyver
@takluyver
Nov 03 2014 20:11
great
Jonathan Frederic
@jdfreder
Nov 03 2014 20:11
Do you know when the article will be posted in nature?
Or, put a different way, when we will see live traffic because of nature?
Brian E. Granger
@ellisonbg
Nov 03 2014 20:23
Yes, it goes live at 11 AM PST on Wed.
Jason Grout
@jasongrout
Nov 03 2014 20:58
Someone should make sure to post it up to HackerNews, Reddit, etc.
Brian E. Granger
@ellisonbg
Nov 03 2014 21:00
LOL, that will make Kyle a bit nervous I think - let's give it a few days of being live to work out the bugs before we open the floodgates of users....
Jason Grout
@jasongrout
Nov 03 2014 21:00
Oh, so the floodgates are on HN, not on Nature?
or rather, maybe opening one floodgate at a time is good
though I think you'll have little control over it being reposted once it hits Nature
Brian E. Granger
@ellisonbg
Nov 03 2014 21:01
Yes, stages of floodgates :)
Jason Grout
@jasongrout
Nov 03 2014 21:01
ls
sorry, wrong window.
so I'm thinking more about distributing python packages that have things to install in nbextensions. I know that the quantopian grid package had a separate install_nb function that installed the nb_extension stuff, that you had to run after the install.
I'm thinking of providing that, but also making the top-level setup.py install/develop install or symlink the nbextension stuff. Am I missing anything by having pip do the nbextension install?
(looking for any wisdom from people that have thought about distributing python packages with widgets)
Jason Grout
@jasongrout
Nov 03 2014 21:07
I wonder what the feasibility is of having a setuptools extension or something that lets you specify stuff to put in the nbextensions
Andreas Klostermann
@akloster
Nov 03 2014 21:19
I think extensions like live_reveal should be a python library, imported to the notebook rather than extensions installed someplace in the user's profile
@jasongrout I have also put some thought into packaging javascript/coffeescript code for the notebook, see https://github.com/akloster/nb-assets
Matthias Bussonnier
@Carreau
Nov 03 2014 21:23
but things like reval work on non-python kernel.
Andreas Klostermann
@akloster
Nov 03 2014 21:23
good point
Matthias Bussonnier
@Carreau
Nov 03 2014 21:23
So no it should not be a python package that need to be imported., it should be agnostic from underlying language.
We are still wondering how to do...
Andreas Klostermann
@akloster
Nov 03 2014 21:25
my current issues with live_reveal is that I always have to tweak it in various ways, and I can't customize individual presentations or notebooks
Matthias Bussonnier
@Carreau
Nov 03 2014 21:26
in what sens ?
Andreas Klostermann
@akloster
Nov 03 2014 21:27
mostly bugs, but also page widths, and lately I had issues with the un-revealing not working
Also some aspects of styling are in the notebook, and some are in the custom.js ... but that's OK I guess
I know that live_reveal isn't in any form meant to be production ready and I can live with the quirks. It makes up for this by enabling cool demo presentations ;-)
Matthias Bussonnier
@Carreau
Nov 03 2014 21:39
you should be able to fix things in custom.css. Agreed with un-revealing, but that already awesome that it works :-)
Andreas Klostermann
@akloster
Nov 03 2014 21:53
presentations are essentially unportable, then
Jason Grout
@jasongrout
Nov 03 2014 22:05
@Carreau - what is reval?
Jonathan Frederic
@jdfreder
Nov 03 2014 22:05
typo for reveal I think
reveal.js*
Jason Grout
@jasongrout
Nov 03 2014 22:05
ah, sure.
my use-case is more restricted. IPython widget python and javascript (for example, pythreejs). I'm not trying to install an arbitrary javascript thing, but just the js half of my package.
since the package is already a python package, it makes sense to use something like distutils.
(well, I guess it doesn't ever make sense to use distutils, but it's the best we've got...)
and if I've already started accepting javascript coding, hey, what's one more compromise?
Thomas Kluyver
@takluyver
Nov 03 2014 22:08
if your JS code goes along with Python code, I would copy it into nbextensions at runtime
Jason Grout
@jasongrout
Nov 03 2014 22:08
at runtime?
Jonathan Frederic
@jdfreder
Nov 03 2014 22:08
Did you look at @ellisonbg 's leaflet widget? I don't remember, but he may have found a nice to do it
Jason Grout
@jasongrout
Nov 03 2014 22:08
like when the widget is instantiated?
Thomas Kluyver
@takluyver
Nov 03 2014 22:08
yep
as part of instantiation, ensure that the JS files to deal with it are in place
Jason Grout
@jasongrout
Nov 03 2014 22:08
wow, talk about just-in-time installation
Thomas Kluyver
@takluyver
Nov 03 2014 22:08
it's what I do with mobilechelonian
Jonathan Frederic
@jdfreder
Nov 03 2014 22:08
@takluyver is that how you do the turtle widget?
ah
yeah
Jason Grout
@jasongrout
Nov 03 2014 22:09
I was hoping to not have to put the js in the python site-local directory
a top-level python-only package, and a top-level js package
and you do something like python setup.py install and python setup.py install-nb
Thomas Kluyver
@takluyver
Nov 03 2014 22:09
I think sticking data files inside Python packages is fairly well accepted
Jason Grout
@jasongrout
Nov 03 2014 22:09
but are you then using the pkg_resources stuff?
Thomas Kluyver
@takluyver
Nov 03 2014 22:09
I actually symlink it into nbextensions, IIRC
no, I just use __file__ to look it up
Jason Grout
@jasongrout
Nov 03 2014 22:10
ah, so it doesn't work if your package is installed as a zip file
setuptools makes a big deal about that
Thomas Kluyver
@takluyver
Nov 03 2014 22:11
yeah, but I've long since decided I don't care about setuptools
so you just check for the symlink, see if it leads to the right place, and then fix it/create it if it doesn't?
Andreas Klostermann
@akloster
Nov 03 2014 22:12
My solution is to find the directory of the python module, then load the javascript file from there
with regard to the python/js widget stuff
Thomas Kluyver
@takluyver
Nov 03 2014 22:13
I just call install_nbextension(..., symlink=True)
I think it will overwrite the symlink if it already exists
Jonathan Frederic
@jdfreder
Nov 03 2014 22:15
@jasongrout I finished implementing stacked errors in the promise PR, when you have some free time check it out. I'm going to be debugging the JS tests in the meantime.
Thomas Kluyver
@takluyver
Nov 03 2014 22:15
oh no, it does a check
Jason Grout
@jasongrout
Nov 03 2014 22:16
so that works well with one widget. It gets cumbersome if you have dozens of widgets, any of which might get used
I suppose you could install at import time.
it's nice that you don't have a separate installation step
Andreas Klostermann
@akloster
Nov 03 2014 22:17
I think having some call like output_notebook or install_js is ok, or even better than import time, because it makes loading the code implicit
sometimes the notebook isn't trusted, or you want to reload the js code in development, then you can explicitly reexecute this
Jason Grout
@jasongrout
Nov 03 2014 22:19
thanks everyone; I'll think about it.
@jdfreder: I'll try to look at this tomorrow.
Jonathan Frederic
@jdfreder
Nov 03 2014 22:20
Thanks :)
Jason Grout
@jasongrout
Nov 03 2014 22:20
(this=promise pr)
Jonathan Frederic
@jdfreder
Nov 03 2014 22:20
no rush
just letting you know
Thomas Kluyver
@takluyver
Nov 03 2014 22:22
for the turtle thing, I was especially keen to make it as automatic as practical, because of the target audience.
Jason Grout
@jasongrout
Nov 03 2014 22:22
return new Promise(function(resolve, reject) {setTimeout(function() {look_at_pr(resolve, reject)}, 64800000)})
Thomas Kluyver
@takluyver
Nov 03 2014 22:22
copying files around at import time is usually a bad idea
Jason Grout
@jasongrout
Nov 03 2014 22:23
symlinking sounded a lot better than copying to me
the problem with symlinking at install time is that if you are installing a global install, whose .ipython is it going to symlink?
there's not a global ipython nbextension directory, is there?
perhaps in site-local/ipython or something?
Jonathan Frederic
@jdfreder
Nov 03 2014 22:30
@jasongrout lol
Thomas Kluyver
@takluyver
Nov 03 2014 22:30
there probably should be a systemwide location
/usr/share[/local]/ipython/nbextensions, I guess
we already have .../kernels in the same place