Re: [jupyter] How does jupyter show dataframe as html table ?

2017-12-20 Thread Charles Forelle
The pandas DataFrame class defines a _repr_html_ method that returns an
HTML string.

On Wed, Dec 20, 2017 at 2:13 AM Jeff Zhang  wrote:

> Just wondering how does jupyter do that ? Is there any display hook for
> that ? and how's that implemented. Thanks
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+unsubscr...@googlegroups.com.
> To post to this group, send email to jupyter@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/c1139ebd-9f0c-463d-97bf-8b8ad25435c8%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAOFssWwVD_w5-Ve%3Ddy2W2%3DEvi21tdKj76EdcS4a7VE%2B_EbSKzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Auto-running notebook and hooking an event on completion

2017-12-20 Thread Thomas Kluyver
You could use the --execute option when you call nbconvert.

On 20 December 2017 at 02:30, Pouya Ghadimi Karahrodi <
pouya.ghad...@gmail.com> wrote:

> Is this resolved ? I am trying to automate a notebook run and conversion
> to pdf.
> The missing step is the save after the notebook run completion.
> I am managing this through commands:
>  %run ./notebook.ipynb --inputParameters
> and then
> subprocess.call(["jupyter", "nbconvert" 
> ,"--to=pdf","--template=template.tplx",
> "notebook.ipynb"])
>
> Having this setup it misses the save and doesn't have the updated fields.
>
> Any suggestion to fix this ?
>
>
> On Friday, October 9, 2015 at 8:54:23 PM UTC+11, Min RK wrote:
>>
>> The kernel should know that it has outstanding requests, so you ought to
>> be able to query that, to determine whether.
>>
>> There isn’t a public API for this information, but this should work for
>> now:
>>
>> finished = (Object.keys(IPython.notebook.kernel._msg_callbacks).length == 0);
>>
>> If you check that value when idle events arrive, it should tell you when
>> the notebook is actually done or not.
>>
>> -MinRK
>> ​
>>
>> On Thu, Oct 8, 2015 at 9:18 PM, Graham Wheeler 
>> wrote:
>>
>>> Hi all
>>>
>>> I'm trying to have a custom.js that will automatically run a notebook
>>> when it gets opened or reloaded, and then hook an event handler when done.
>>>
>>> I'm trying this to start:
>>>
>>> require(['base/js/namespace', 'base/js/events', 'base/js/dialog',
>>> 'base/js/utils', 'base/js/security'], function() {
>>>   $([IPython.events]).on('kernel_ready.Kernel kernel_created.Session
>>> notebook_loaded.Notebook', run_notebook);
>>> });
>>>
>>> That seems to work okay.
>>>
>>> Getting completion event handling seems more tricky. I have:
>>>
>>> function run_notebook() {
>>>   var pageClass = document.body.className;
>>>   if (pageClass.indexOf('notebook_app') >= 0) {
>>> IPython.notebook.clear_all_output();
>>> IPython.notebook.execute_all_cells();
>>>
>>>// My problem is here - how to tell when done.
>>>
>>>// One attempt - this seems to run over and over
>>> $([IPython.events]).on('kernel_idle.Kernel', function() {
>>> checkIfDone();
>>> });
>>>
>>> // Another attempt - this doesn't seem to work at all
>>> setTimeout(5000, function() {
>>>   checkIfDone();
>>> });
>>>   }
>>> }
>>>
>>> function checkIfDone() {
>>>   if (IPython.notebook.kernel_busy) {
>>> setTimeout(5000, function() {
>>>   checkIfDone();
>>> });
>>>   } else {
>>> console.log('Finished execution');
>>>   }
>>> }
>>>
>>> Is there a better way? Some other event to hook into?
>>>
>>> Thanks!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Project Jupyter" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to jupyter+u...@googlegroups.com.
>>> To post to this group, send email to jup...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/jupyter/0982776e-ea36-447c-a45c-d6c75775cb3f%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+unsubscr...@googlegroups.com.
> To post to this group, send email to jupyter@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/8f7d5e8e-bcb8-47cf-9616-386126f4bda6%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAOvn4qi5__fiH7Me35-zHDxyXj5hicJS%2BNPX3OqJQudgni_L1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] IPython.notebook.kernel.execute() won't let me assign js UTF-8 strings

2017-12-20 Thread Thomas Kluyver
Hi Harris,

Can you show the code that you're running? I'm having trouble following the
description.

Thomas

On 20 December 2017 at 06:23, Harris Joseph 
wrote:

>
> To avoid collisions on the server's filesystem, I am trying to upload csv
> files as strings directly into the python kernel using javascript and
> kernel.execute() after converting it to UTF-8 with 
> FileReader.readAsText().result.
> I have tested the javascript function and it consistently prints the entire
> file to the console if I put a console.log() inside the callback function
> where I call kernel.execute() and send it the same variable outputString
> that gets built into  var command = "dataString ='"+outputString+"'";
> before being passed to kernel.execute. I was doing this all inside a magic
> %%HTML cell with 

Re: [jupyter] Re: How does jupyter show dataframe as html table ?

2017-12-20 Thread Thomas Kluyver
Plus overview docs here:
http://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display

On 20 December 2017 at 07:08, Lawrence D’Oliveiro 
wrote:

> On Wednesday, December 20, 2017 at 3:13:55 PM UTC+13, Jeff Zhang wrote:
>>
>> Just wondering how does jupyter do that ?
>>
>
> Python code can format text output as HTML or Markdown, and can also
> output arbitrary PNG graphics and audio.
>
> Examples here
> ,
> API docs here
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+unsubscr...@googlegroups.com.
> To post to this group, send email to jupyter@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/17c429dc-153c-4e30-b4d4-d9b446fefb61%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAOvn4qgivpMsghom-36DfRH6EEfKVq%3DjKc-g_RwW5_FYEWt1Qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Re: Restart snippet numbering in the middle of a notebook?

2017-12-20 Thread Fernando Perez
On Mon, Dec 18, 2017 at 10:48 PM, Roland Weber  wrote:

> Restart the kernel before each section. That will clear all state in
> memory, and reset the execution count
>

You can also force that number to be any value with:

ip = get_ipython()
ip.history_manager.enabled = False  # needed to avoid duplicate line #
error messages
ip.execution_count = 0  # your number here

and it will start counting at that number from then on.  OP could put that
in a little utility/magic that resets it to 1, and then drop those cells
from the book output with a tag.

Visual example:

[image: Inline image 1]

cheers,

f

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAHAreOocmzVN6Q%3DOH0E_ZrSpMdWeYV4yv3Ya64f-x5fXXaGofA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Insert Current date - Markdown ?

2017-12-20 Thread Fionn Delahunty
Is it possible to have markdown update with the current date? 

Saves me updating the date each time I edit a file. 

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/d791bce9-8a40-4f88-82aa-df74fc639e5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Insert Current date - Markdown ?

2017-12-20 Thread Thomas Kluyver
Something like this extension?

http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/datestamper/readme.html

If that's not quite what you're after, have a look through this list of
extensions, there may be one that's closer:
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/

On 20 December 2017 at 11:16, Fionn Delahunty 
wrote:

> Is it possible to have markdown update with the current date?
>
> Saves me updating the date each time I edit a file.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+unsubscr...@googlegroups.com.
> To post to this group, send email to jupyter@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/d791bce9-8a40-4f88-82aa-df74fc639e5f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAOvn4qidUv3UwVvuEj65qsQRqn%3DAdPeHuGDT2-_o6Tf-RFjOJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Planning to shutdown tmpnb.org in favor of mybinder.org

2017-12-20 Thread MinRK
tmpnb.org powers https://try.jupyter.org, and is a lightweight service for
temporary notebook servers. However, tmpnb gets a lot less light as the
number of users grows, and the scope of what we want to demo grows. Since
tmpnb only allows serving a single repo, we’ve had to build an
enormous kitchen-sink
docker image  with
everything we want to demo. This is not sustainable, and keeping tmpnb.org
up isn’t really working anymore. With the new Binder 
up and running, there is a better avenue for demoing Jupyter use cases that
doesn’t require trying to build a one-size-fits-all demo.

Our plan is to update the try.jupyter.org page to be a set of links to
Binder repos demoing Jupyter, and shutdown the tmpnb.org service. This will
involve:

   - creating a few binderable repos for demoing Jupyter
   - making try.jupyter.org a landing page pointing to a few selected demo
   repos on Binder
   - shutting down tmpnb.org
   - putting the docker-demo-images repo in the attic, since people who
   want to demo their own work can now create Binders instead of adding to the
   big demo image.

See the GitHub Issue 
for further planning.

We don’t have a timeframe for this yet, but if you are relying on tmpnb.org
for anything let us know. The odds are that Binder can already serve you
better than tmpnb does right now.

-Min
​

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAHNn8BUG%2BXR9BVLzoichdeWO34zXvwJ4GFTeirMMp84pa9UemA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Re: how to test for running server?

2017-12-20 Thread Lawrence D’Oliveiro
On Wednesday, December 20, 2017 at 11:44:35 AM UTC+13, Tim Harsch wrote:
>
> I see with JupyterHub API you can POST or DELETE to  /users/{name}/server 
> but there doesn't seem to be a GET.  If that's true is there another way I 
> can test for a running server other than POST or DELETE which have their 
> side effects?..
>

Whether POST and GET have “side” effects or not is entirely up to how the 
server interprets the request. 

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/b9756ee0-5c2e-48bb-af01-7db3316c3397%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Re: how to test for running server?

2017-12-20 Thread Tim Harsch
Right.  Sorry, I should have been more clear.  In the case of DELETE, if 
you attempt to DELETE when no server is running you will get a HTTP 400 and 
no action taken.  But, if you DELETE and a server is running then the 
server stops and you will get HTTP 204(I think).   Similar logic for POST.  
I really just want to check the status, without causing stop or start of 
the server.

Since there seems to be no GET method, could I possibly something using the 
services?  or maybe I could implement the GET ?  Just looking for advice on 
best way forward..

Thanks,
Tim

On Wednesday, December 20, 2017 at 3:26:32 PM UTC-8, Lawrence D’Oliveiro 
wrote:
>
> On Wednesday, December 20, 2017 at 11:44:35 AM UTC+13, Tim Harsch wrote:
>>
>> I see with JupyterHub API you can POST or DELETE to  /users/{name}/server 
>> but there doesn't seem to be a GET.  If that's true is there another way I 
>> can test for a running server other than POST or DELETE which have their 
>> side effects?..
>>
>
> Whether POST and GET have “side” effects or not is entirely up to how the 
> server interprets the request. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/4de7b283-659c-4d63-ad8e-ca5c432f5b12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.