sympy_gamma icon indicating copy to clipboard operation
sympy_gamma copied to clipboard

Download as IPython Notebook

Open certik opened this issue 12 years ago • 15 comments

It'd be cool to have a link to open the current page as IPython Notebook.

To implement it, I would simply create a Json file (the IPython Notebook format) with all the commands (i.e. derivatives, integrals, graphs, ...). When you load it to the IPython notebook and execute, it should roughly reproduce the SymPy Gamma page.

certik avatar Nov 27 '13 21:11 certik

Yeah!, It will be nice to have such a thing. We can actually render the ipython notebook in html format rather than the notebooks' page and we can also have links to download the output in different formats. I think this is what i can do. I am currently starting work on this. Will keep you posted... :)

sahilshekhawat avatar Jan 12 '14 08:01 sahilshekhawat

Will nbconvert work on the app engine? It depends on pandoc.

asmeurer avatar Jan 12 '14 19:01 asmeurer

nbconvert is part of Ipython. True, it depends on pandoc. before starting off, I would point to some of the issues nbconvert has look at https://github.com/ipython/nbconvert/issues/37 and confirm whether we can have pandoc working on GAE.

borntorock avatar Jan 13 '14 01:01 borntorock

Pandoc won't work on App Engine, as it's written in Haskell...perhaps just having the Markdown/html, Python, and .ipynb outputs would be enough.

lidavidm avatar Jan 13 '14 21:01 lidavidm

@certik where is Sympygamma.com hosted. Will we be able to make ipython ntoeboom work over there.

borntorock avatar Jan 13 '14 21:01 borntorock

It is hosted on Google App Engine.

lidavidm avatar Jan 13 '14 21:01 lidavidm

I believe Ondrej's idea of creating the ipynb JSON file for export is best, because the reason for exporting to IPython is to let the user continue to work with the math in IPython after getting a result from Gamma. For PDF/HTML export it would be best to create a print media stylesheet to format the page for printing, at which point the user could print to PDF. Getting pandoc/nbconvert to somehow run on App Engine would be too much trouble. It would also be possible to have the server generate a PDF file, or more speculatively, use something like Texlive.js to run LaTeX in the browser (though Texlive.js is GPL licensed, so we'd have to be careful).

lidavidm avatar Jan 13 '14 21:01 lidavidm

I'm with you David. Thanks for the advice. I was trying for nbconvert and pandoc but i think i will go by your way now.

sahilshekhawat avatar Jan 14 '14 06:01 sahilshekhawat

For getting the output to be rendered as pdf file, one has to use something running on the server, as David pointed out one can use Texlive.js but I went though that, running that would be somewhat troublesome.

@lidavidm Can we think of any other way of rendering the output as pdf file/ html file.

borntorock avatar Jan 14 '14 06:01 borntorock

There's really no point trying to generate a PDF. Let the user print to PDF.

A web page is HTML, so all we need is CSS to reformat the page for printing. Look into CSS media types if you're not familiar with this.

lidavidm avatar Jan 14 '14 22:01 lidavidm

As a first step, we need to be able to save to the ipython JSON format. That doesn't require any special libraries, except json support, which is available in the Python standard library. So that's what I would do.

After this works well, then I would let the user figure out what he or she wants to do with it. In particular, you can save the ipython notebook to pdf, and I would let the ipython guys figure out the technical details. What we can do, however, is to have two links, something like:

  • IPython notebook: page.ipynb (html view)

where the page.ipynb would simply serve the ipython json source code, and view would link to nbviewer that would provide html view of this notebook.

certik avatar Jan 14 '14 22:01 certik

We could export it to gist and let the user open it in nbviewer. There are also tools like Wakari that let you actually run IPython notebooks in the cloud (full disclosure: I work for Continuum, which makes Wakari, though I do not personally work on Wakari). Sage cloud is similar, I believe.

asmeurer avatar Jan 15 '14 00:01 asmeurer

I think that's the best --- export to gist and provide a link to nbviewer viewing the gist.

certik avatar Jan 15 '14 00:01 certik

I think that instead of exporting to gist we can give the json file a url and after that give the link to nbviewer which renders that json file and if a user wants he can download it..why involve gist? It will be too much trouble if the requests increases significantly to actually export each and every file to gist first and then view that in nbviewer...what say? Am i on right path? And the thing about creating a json file of our results page..leave that upto me..I am currently working on the same.

sahilshekhawat avatar Jan 15 '14 09:01 sahilshekhawat

That's fine, just start with exposing the url. Post a PR, we'll test it, and then we'll go from there.

Ondrej

On Wed, Jan 15, 2014 at 2:02 AM, sahil shekhawat [email protected]:

I think that instead of exporting to gist we can give the json file a url and after that give the link to nbviewer which renders that json file and if a user wants he can download it..why involve gist? It will be too much trouble if the requests increases significantly to actually export each and every file to gist first and then view that in nbviewer...what say? Am i on right path? And the thing about creating a json file of our results page..leave that upto me..I am currently working on the same.

— Reply to this email directly or view it on GitHubhttps://github.com/sympy/sympy_gamma/issues/22#issuecomment-32344386 .

certik avatar Jan 15 '14 19:01 certik