These are chat archives for ipython/ipython

30th
Oct 2014
Min RK
@minrk
Oct 30 2014 02:28
@all no dev meeting tomorrow, we've been dev-meeting-ing all week.
Jason Grout
@jasongrout
Oct 30 2014 12:45
@jdfreder: I have an initial promise support implementation. I think that may make more sense than an ad-hoc callback system, since it basically is the same as callbacks, but in a standardized framework that is part of ES6 and already adopted by Chrome, Firefox, and Safari, and in the works for IE
(but I think it may make most sense to integrate my ViewList implementation into the final result, as it shields the user from some of this)
Jonathan Frederic
@jdfreder
Oct 30 2014 16:02
@jasongrout that's awesome
pulling up Github.
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:13
hi! I wanted to convert an ipynb to PDF and get error file not found from "ipython nbconvert trytdd.ipynb --to latex --post PDF --debug" . I think it's complaining because I don't have pdflatex on my path. How can I fix the error message? I'm trying to find where in the code to look. I see first that the syntax changed on the command line app. It used to be --post PDF added to --to latex. Now (or on dev github that is) it uses --to PDF.
I'd like to submit a PR but from the error stack I wasn't clear where to fix.
(that's the history that shows when the --post pdf was removed)
Thomas Kluyver
@takluyver
Oct 30 2014 16:20
@AnneTheAgile , I think what you're looking for is in this file: https://github.com/ipython/ipython/blob/master/IPython/nbconvert/exporters/pdf.py
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:33
@takluyver , yes I think so too! My output shows "[NbConvertApp] Building PDF: ['pdflatex', 'trytdd.tex']" which is indicated on L122.
Is there a way I can run it with PDB to see further?
Thomas Kluyver
@takluyver
Oct 30 2014 16:34
hmm, probably - I don't use pdb much myself, so I don't really know
there may be a --debug option to turn on extra logging
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:35
right, I tried that, it gave a bit more help. OK, well, alternatively, the next thing it does is; "return self.run_command(self.latex_command, filename,
self.latex_count, log_error)"
but I'm unclear where that is calling?
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:37
looking more. btw how do you easily get that so nice url with line#?
I do not get this line 68; self.log.info("Running %s %i %s: %s", command_list[0], count, times, command)
hmm, wait, I might be mixing apples/oranges since the master, which is where I'm exploring has the syntax change.
I need to figure out how to run the dev version if ipy.
Thomas Kluyver
@takluyver
Oct 30 2014 16:40
to get the URL - click on the line number in Github
if you clone the repository, you can just python setup.py install it
it's a good idea to use a conda env or virtualenv so it doesn't replace your normal IPython installatino
installation
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:42
great idea. I'm on firefox, but click the line# does highlight it but no right click option?
Thomas Kluyver
@takluyver
Oct 30 2014 16:44
click it, then copy the URL out of the address bar :)
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:46
oh my gosh!! ty so much @takluyver . OK, I will go install locally with my conda env
I hadn't noticed it doing a page refresh
Thomas Kluyver
@takluyver
Oct 30 2014 16:47
it doesn't actually refresh the page - JS can modify the #something part of the URL without refreshing the page.
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:47
ah, ok!
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:52
I'm googling, but do you know right off, if I make my new env, then activate it, am I safe to just run the python setup.py install in my git repo folder?
and it will be installed only into my custom environment in conda?
Thomas Kluyver
@takluyver
Oct 30 2014 16:53
yep, so long as the conda env is active, python should refer to the Python inside that env
AnneTheAgile
@AnneTheAgile
Oct 30 2014 16:54
great! ty!
I always worry you know :)
about new things
Thomas Kluyver
@takluyver
Oct 30 2014 16:57
:) that's fair enough, it's worth being a bit cautious
Thomas Kluyver
@takluyver
Oct 30 2014 17:09
I've just rebuilt the docs, so the How IPython Works doc is now live to point people to.
Jason Grout
@jasongrout
Oct 30 2014 17:20
@jdfreder: in-progress promises PR: ipython/ipython#6817
(I won't be working on it for a few hours, though)
Jonathan Frederic
@jdfreder
Oct 30 2014 17:21
Ok, I've been working on one in the meantime too (since I couldn't find your PR this morning)
Jason Grout
@jasongrout
Oct 30 2014 23:23
@jdfreder: how's it going with the promises stuff?
Jonathan Frederic
@jdfreder
Oct 30 2014 23:24
@jasongrout was just going to ping you too
:)
Good
I just pulled your commit into my branch
@minrk @ellisonbg @takluyver @jasongrout Regarding the require.js+widget loading issues: I've looked at both the promise and callback based solutions, and the promise solution is far simpler. Primarily because of the Promise.all method, which allows the unpack_models method to recursively execute. I have a 'complete' promise based solution implemented in #6818 , but before I continue to debug it and integrate something like https://github.com/tildeio/rsvp.js (which will give us Promises in all of the browsers we care about and then some) I wanted to make sure everyone is okay with moving in that direction..
Jason Grout
@jasongrout
Oct 30 2014 23:25
+1. I was hoping using Promise.all would work out.
The bad thing is that it stops all of the view creation if any of them failes
Jonathan Frederic
@jdfreder
Oct 30 2014 23:25
Yeah :(
but it will console.error
Jason Grout
@jasongrout
Oct 30 2014 23:25
but that's probably an acceptable tradeoff. The nice thing is that Promise.all gives you back the things in order
So I was thinking that the viewlist would use Promise.all to create all of the views it needed to add to the list.
or at least load all of the views, and then I could call the add handler one-by-one in order.
eh, I'm still confused, actually.
Thomas Kluyver
@takluyver
Oct 30 2014 23:28
yep, if promises buy us something useful over callbacks, I'm happy to start using them.
Jonathan Frederic
@jdfreder
Oct 30 2014 23:28
@jasongrout I think it would work like _unpack_models does in my branch:
Jason Grout
@jasongrout
Oct 30 2014 23:28
the really nice thing is if you can use generators and yield, you can write python 3-like code that looks like coroutines to do the asynchronous stuff

spawn(function *() {
try {
// 'yield' effectively does an async wait,
// returning the result of the promise
let story = yield getJSON('story.json');
addHtmlToPage(story.heading);

// Map our array of chapter urls to
// an array of chapter json promises.
// This makes sure they all download parallel.
let chapterPromises = story.chapterUrls.map(getJSON);

for (let chapterPromise of chapterPromises) {
  // Wait for each chapter to be ready, then add it to the page
  let chapter = yield chapterPromise;
  addHtmlToPage(chapter.html);
}

addTextToPage("All done");

}
catch (err) {
// try/catch just works, rejected promises are thrown here
addTextToPage("Argh, broken: " + err.message);
}
document.querySelector('.spinner').style.display = 'none';
});

spawn(function *() {
  try {
    // 'yield' effectively does an async wait,
    // returning the result of the promise
    let story = yield getJSON('story.json');
    addHtmlToPage(story.heading);

    // Map our array of chapter urls to
    // an array of chapter json promises.
    // This makes sure they all download parallel.
    let chapterPromises = story.chapterUrls.map(getJSON);

    for (let chapterPromise of chapterPromises) {
      // Wait for each chapter to be ready, then add it to the page
      let chapter = yield chapterPromise;
      addHtmlToPage(chapter.html);
    }

    addTextToPage("All done");
  }
  catch (err) {
    // try/catch just works, rejected promises are thrown here
    addTextToPage("Argh, broken: " + err.message);
  }
  document.querySelector('.spinner').style.display = 'none';
});
from the bottom of http://www.html5rocks.com/en/tutorials/es6/promises/
Jonathan Frederic
@jdfreder
Oct 30 2014 23:34
wow that is really nice
I don't think RSVP.js includes a yield
(I don't see how it could)
but once yield matures, I think that would make a lot of our asynchronous code easier to read.
Jason Grout
@jasongrout
Oct 30 2014 23:37
no, of course not. But Chrome 38 does :). And so does Firefox, IIRC
so we would do something like:
view = yield create_view(model)