Re: [IPython-dev] [sage-devel] Re: Jupyter notebook by default?

2016-01-09 Thread MinRK
On Sat, Jan 9, 2016 at 8:04 AM, kcrisman  wrote:

> These all sound like awesome ideas to me for moving more *robustly* to a
> sws -> ipynb transition!  Would attached files work properly (or at all)?
> I'm only asking out of ignorance.
>

No, attached files would likely be placed next to the notebook.

-MinRK


> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/8erxWppKxXM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [IPython-dev] [sage-devel] Re: Jupyter notebook by default?

2016-01-08 Thread kcrisman
These all sound like awesome ideas to me for moving more *robustly* to a 
sws -> ipynb transition!  Would attached files work properly (or at all)? 
 I'm only asking out of ignorance.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [IPython-dev] [sage-devel] Re: Jupyter notebook by default?

2016-01-07 Thread MinRK
Thanks Jason for cross-posting.

Since the issue of funding was brought up, I think supporting projects like
this is exactly the sort of thing we should be doing with the funding we
have, whether the work sits on the Jupyter or Sage side (I assume there
will be both). It’s a bit tricky to keep track of all the points in an
email thread, but if we could aggregate the things that are blockers and
the things that would be nice, especially changes you need from Jupyter, we
should be able to start ticking boxes.

A summary of what I’ve seen so far:

   - sage interacts
   - language cells
   - document conversion from sagenb to ipynb
   - low-level output capturing
   - gracefully handling large output

Some comments:

Re: language cells, I assume it’s referring to things like %%bash, %%R, and
%%cython. While these *look* similar, there is a significant difference in
how they are implemented. For instance, the R magic (provided by rpy2) runs
an R interpreter in-memory, and talks to it, capturing output, etc.. Where
many of these magics, such as bash, ruby, perl, come from is some “script
magic” machinery in IPython, which populates the default magics with
shortcuts to running a script in a given interpreter. They are essentially
shortcuts to cat  | . It’s not a fundamental limitation,
or anything dire like that. If sage has an implementation of running code
in a persistent alternate interpreter, then it should not be much work to
represent that in magics, since cell magics are any Python functions called
with two string arguments (the rest of the line and the cell), and can be
defined at any time, for instance:

def mymagic(line, cell):
do_stuff_with(cell)

get_ipython().register_magic_function(mymagic, 'cell')

Re: output capturing, Thomas Kluyver and I were at CERN last month working
on the Cling kernel, and one of the things we did was C-level capturing of
output. Now that we have that working, integrating it into the IPython
kernel should not be much work, and if it’s really important, libraries can
use the same technique themselves without waiting for IPython to catch up.

Interacts are perhaps the hardest piece. I think it should be doable to get
sage’s own interacts working in the notebook, rather than forcing people to
adopt the much more basic interact provided by the IPython widgets.

I can’t speak to the UI transition part of the problem whenever you change
defaults, which is a big challenge, but I think we can at least mitigate
most of the things on the Jupyter side that are getting in your way.

-MinRK
​

On Tue, Jan 5, 2016 at 8:19 PM, Jason Grout  wrote:

> (cross-posting to ipython-dev)
>
> Jon,
>
> At the recent San Francisco meetings, we talked about this.  What do you
> think about:
>
> 1. keeping track of the size of the io messages sent from any specific
> kernel execution
> 2. When the total size of io reaches some specific size
> (user-configurable), transmitting a special "throwing away output, but
> here's how to save the output to a file if you want in the future, or how
> to increase the limit" message
> 3. keep a running buffer of the last bit of output attempted to be sent,
> and send it when the execution finishes (so basically a ring buffer that
> overwrites the oldest message)
>
> This:
>
> * allows small output through
> * provides an explanatory message
> * provides the last bit of output as well
>
> One thing to figure out: a limit on size of output that is text may not be
> appropriate for output that is images, etc.
>
> Thanks,
>
> Jason
>
>
> On Tue, Jan 5, 2016 at 12:11 PM, Jason Grout  wrote:
>
>>
>> -- Forwarded message --
>> From: Jonathan Frederic 
>> Date: Tue, Jan 5, 2016 at 11:42 AM
>> Subject: Re: [sage-devel] Re: Jupyter notebook by default?
>> To: Jason Grout 
>> Cc: sage-devel 
>>
>>
>> Jason,
>>
>> Thanks for pulling me in on this.
>>
>> William,
>>
>> I agree, getting a bunch of people to agree on stuff can seem
>> impossible.  However, you mention Sage offers a couple options to mitigate
>> output overflows, can you point me to those options?  The Jupyter Notebook
>> should provide multiple options too - this will also make it easier for
>> everyone to agree.
>>
>> Also, in you experience, which of these options work the best?
>>
>> I was thinking initially of doing something simple, like hard limiting
>> data/time, then printing an error if that's exceeded.  In the Jupyter
>> Notebook, we have to worry about
>> - Too many messages sent on the websocket
>> - The notebook json file growing too large and consequently becoming
>> unopenable
>> - Too much data being appended to the DOM, crashing the browser
>>
>>
>> Thanks!
>> -Jon
>>
>> On Tue, Jan 5, 2016 at 10:19 AM, Jason Grout 
>> wrote:
>>
>>>
>>>
>>> On Tuesday, January 5, 2016 at 8:17:45 AM UTC-7, William wrote:


 One example of a 

Re: [IPython-dev] [sage-devel] Re: Jupyter notebook by default?

2016-01-07 Thread Thierry
Hi,

On Thu, Jan 07, 2016 at 11:48:05AM +0100, MinRK wrote:
[...]
>- document conversion from sagenb to ipynb

We should probably better focus on a good rst2ipynb translator.

Indeed, there is a "sage -sws2rst" command already. This will have the
benefit to be helpful for more people than just Sage users, and help us
going towards Jupyter live documentation i.e. ipynb files connected
together with a bit of sphinx (i dont' know if it is possible to add a
navigation bar to ipynb worksheets, or use frames, or whatever ?).

Moreover, all the developpers i met during tutorials and schools write
their tutorials in .rst, simply because it is human writeable, it is easy
to copy-paste from existing Sage doctests and tutorials, and can be easily
versionned/shared/imported.

Though json is far better than tar.bz or xml from the human point of view,
it is still too verbose to be considered as a source format for
worksheets, moreover from my little experience, people who write tutorials
prefer to use an editor/IDE/whatever than a webpage.

With pandoc and notedown, it is easy to do basic translation rst -> md ->
ipynb. The main remaining task is to let the code blocks clever, that is:

::
sage: a = 1
sage: 2*a
2
sage: 1+1
2

should be translated in ipynb as (simplified)

cell:
type: code
language: sage
input:
a = 1
2*a
output:
2
cell:
type: code
language: sage
input:
1+1
output:
2

which is not the case when piping pandoc and notedown (we obtain a single
input block, and the `sage:` are not removed).

Another separate hook could deal with Sage specific tweaks (e.g. `blah`
for :math:`blah`)

Ciao,
Thierry

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.