Re: [jupyter] How to design JupyterLab extension that reacts to pandas function calls

2018-09-18 Thread Adam Rule
Thanks! I've been keeping an eye on that thread and agree, there is a lot 
of overlap.

On Tuesday, September 18, 2018 at 8:56:34 AM UTC-7, Michael Milligan wrote:
>
> FYI you might take a look at the Jupyterlab variable inspector work being 
> tracked here: https://github.com/jupyterlab/jupyterlab/issues/443
>
> Seems like there could be some overlap with what you are trying to do.
>
> Cheers,
> Michael
>
> On Mon, Sep 17, 2018 at 7:42 PM, Adam Rule 
> > wrote:
>
>> Great point Brian. For prototyping's sake monkey patching should be 
>> enough to test if the interaction is valuable or not.
>>
>>
>> On Monday, September 17, 2018 at 4:45:19 PM UTC-7, ellisonbg wrote:
>>>
>>> I think it could be regular python code that uses the Jupyter display 
>>> system to display the information. The challenge is to figure out how to 
>>> detect the pandas function calls and add the needed logic before and after. 
>>> A good starting point might be to just monkey patch the relevant pandas 
>>> calls and wrap them in the logic you need. That would allow you to get 
>>> started quickly and explore the problem space.
>>>
>>> On Mon, Sep 17, 2018 at 3:40 PM Adam Rule  wrote:
>>>
>>>> I have noticed that a number of Jupyter users call df.head(), df.shape, 
>>>> df.describe(), or something similar almost every time they load or 
>>>> manipulate a dataframe to inspect what their manipulation did. I would 
>>>> like 
>>>> to develop an extension or kernel magic that prints useful information to 
>>>> a 
>>>> cell's output based on the pandas function called in that cell. For 
>>>> example, running pd.read_csv() might automatically print the shape and 
>>>> column names of the loaded dataframe and df.drop_duplicates() might 
>>>> automatically print how many duplicates were dropped and how many unique 
>>>> rows remain.
>>>>
>>>> How might I architect such an extension (e.g., a JupyterLab extension, 
>>>> an iPython kernel magic, or something else)? I think I would need to 
>>>> detect 
>>>> when certain pandas functions are about to be run by the kernel and gather 
>>>> information about the dataframe immediately before and after execution. 
>>>> Would that even be feasible?
>>>>
>>>> -- 
>>>> 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/msgid/jupyter/9e1dfb92-87e0-4a8b-b170-370ab7cfabc7%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jupyter/9e1dfb92-87e0-4a8b-b170-370ab7cfabc7%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>> -- 
>>> Brian E. Granger
>>> Associate Professor of Physics and Data Science
>>> Cal Poly State University, San Luis Obispo
>>> @ellisonbg on Twitter and GitHub
>>> bgra...@calpoly.edu and elli...@gmail.com
>>>
>> -- 
>> 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/msgid/jupyter/69c48c2c-2c9f-4ce1-8491-5c98399eb8ff%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jupyter/69c48c2c-2c9f-4ce1-8491-5c98399eb8ff%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Michael Milligan, Ph.D. | Supercomputing Institute
> Assistant Director for  | University of Minnesota
>Application Development  | mill...@umn.edu 
> www.msi.umn.edu/staff/milligan  | Phone: 612-624-8857
>

-- 
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/f5e0aa2b-da70-4ad8-abc9-f525736db1e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] How to design JupyterLab extension that reacts to pandas function calls

2018-09-17 Thread Adam Rule
Great point Brian. For prototyping's sake monkey patching should be enough 
to test if the interaction is valuable or not.


On Monday, September 17, 2018 at 4:45:19 PM UTC-7, ellisonbg wrote:
>
> I think it could be regular python code that uses the Jupyter display 
> system to display the information. The challenge is to figure out how to 
> detect the pandas function calls and add the needed logic before and after. 
> A good starting point might be to just monkey patch the relevant pandas 
> calls and wrap them in the logic you need. That would allow you to get 
> started quickly and explore the problem space.
>
> On Mon, Sep 17, 2018 at 3:40 PM Adam Rule > 
> wrote:
>
>> I have noticed that a number of Jupyter users call df.head(), df.shape, 
>> df.describe(), or something similar almost every time they load or 
>> manipulate a dataframe to inspect what their manipulation did. I would like 
>> to develop an extension or kernel magic that prints useful information to a 
>> cell's output based on the pandas function called in that cell. For 
>> example, running pd.read_csv() might automatically print the shape and 
>> column names of the loaded dataframe and df.drop_duplicates() might 
>> automatically print how many duplicates were dropped and how many unique 
>> rows remain.
>>
>> How might I architect such an extension (e.g., a JupyterLab extension, an 
>> iPython kernel magic, or something else)? I think I would need to detect 
>> when certain pandas functions are about to be run by the kernel and gather 
>> information about the dataframe immediately before and after execution. 
>> Would that even be feasible?
>>
>> -- 
>> 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/msgid/jupyter/9e1dfb92-87e0-4a8b-b170-370ab7cfabc7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jupyter/9e1dfb92-87e0-4a8b-b170-370ab7cfabc7%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Brian E. Granger
> Associate Professor of Physics and Data Science
> Cal Poly State University, San Luis Obispo
> @ellisonbg on Twitter and GitHub
> bgra...@calpoly.edu  and elli...@gmail.com 
>

-- 
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/69c48c2c-2c9f-4ce1-8491-5c98399eb8ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] How to design JupyterLab extension that reacts to pandas function calls

2018-09-17 Thread Adam Rule
I have noticed that a number of Jupyter users call df.head(), df.shape, 
df.describe(), or something similar almost every time they load or 
manipulate a dataframe to inspect what their manipulation did. I would like 
to develop an extension or kernel magic that prints useful information to a 
cell's output based on the pandas function called in that cell. For 
example, running pd.read_csv() might automatically print the shape and 
column names of the loaded dataframe and df.drop_duplicates() might 
automatically print how many duplicates were dropped and how many unique 
rows remain.

How might I architect such an extension (e.g., a JupyterLab extension, an 
iPython kernel magic, or something else)? I think I would need to detect 
when certain pandas functions are about to be run by the kernel and gather 
information about the dataframe immediately before and after execution. 
Would that even be feasible?

-- 
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/9e1dfb92-87e0-4a8b-b170-370ab7cfabc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Add properties to Jupyter.notebook after it is sealed?

2018-01-09 Thread Adam Rule
Thanks for the insights. Lot's of options but I'll just go with 
Jupyter.sidebar then.

On Tuesday, January 9, 2018 at 12:28:07 PM UTC-8, Matthias Bussonnier wrote:
>
> HI Adam, 
>
> The seal() was added to avoid mistyped property that at some point was 
> hard to track on the codebase. It is not possible to unseal an object 
> unfortunately. 
> Assigning to Jupyter.sidebar should  be ok, the context is not shared 
> between tabs or windows, and Jupyter.notebook mostly refer to the the 
> current notebook frontend application more than the actual document.
>
> IIRC Jupyter should also be accessible if you 
> require('base/js/namespace',...), or alternatively you can attach your 
> element to `window` I guess. 
>
> More generally, I _believe_  (but I may be wrong) that if you are using 
> define/require, I believe modules are singleton so  requiring the same path 
> or library return you the sam instance.  So it might work without having to 
> attach sidebar to any global variable. A bit like you would attach 
> something to numpy, or matplotlib.
>
> The extension looks really cool in the gif !
> -- 
> M
>
> On 9 January 2018 at 20:33, Adam Rule <acr...@gmail.com > 
> wrote:
>
>> I am creating a Jupyter Notebook extension 
>> <https://github.com/acrule/janus> for research purposes that creates a 
>> sidebar where users can "hide" cells with implementation details until they 
>> wish to see them. I am doing something similar to Min's old Scratchpad 
>> <https://github.com/minrk/nbextension-scratchpad> extension by creating 
>> a persistent Sidebar element for rendering these "hidden" cells on demand.
>>
>> I was attempting to assign my Sidebar element to Jupyter.notebook.sidebar 
>> so I can reference it later, but it seems Jupyter.notebook is sealed 
>> <https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/js/notebook.js#L252>
>>  so 
>> I cannot add new properties. Is there a way for me to get around this or is 
>> the sealing permanent? For now I am assigning the Sidebar element to 
>> Jupyter.notebook.session.sidebar but am not sure if code manipulating the 
>> notebook session may delete this reference. Alternatively I tried assigning 
>> it to Jupyter.sidebar, but think this will cause problems if a user has 
>> multiple notebooks open.
>>
>> -- 
>> 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/msgid/jupyter/e7365c65-ddd5-4720-844e-275778a8ab31%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jupyter/e7365c65-ddd5-4720-844e-275778a8ab31%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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/c3e2dada-37f3-4325-8fbc-c360c45fab6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Add properties to Jupyter.notebook after it is sealed?

2018-01-09 Thread Adam Rule
I am creating a Jupyter Notebook extension  
for 
research purposes that creates a sidebar where users can "hide" cells with 
implementation details until they wish to see them. I am doing something 
similar to Min's old Scratchpad 
 extension by creating a 
persistent Sidebar element for rendering these "hidden" cells on demand.

I was attempting to assign my Sidebar element to Jupyter.notebook.sidebar 
so I can reference it later, but it seems Jupyter.notebook is sealed 

 so 
I cannot add new properties. Is there a way for me to get around this or is 
the sealing permanent? For now I am assigning the Sidebar element to 
Jupyter.notebook.session.sidebar but am not sure if code manipulating the 
notebook session may delete this reference. Alternatively I tried assigning 
it to Jupyter.sidebar, but think this will cause problems if a user has 
multiple notebooks open.

-- 
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/e7365c65-ddd5-4720-844e-275778a8ab31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Scrollytelling view for notebooks?

2017-12-13 Thread Adam Rule
You're right... there are a lot of details I have not worked out yet. For 
the specific issue of execution order, I think we can communicate that with 
something as simply as a carrot which shows where the sidebar cells would 
insert in the main notebook.

On Wednesday, December 13, 2017 at 2:57:10 AM UTC-8, Tony Hirst wrote:
>
> Adam
>
> Janus looks interesting - I'm just a little confused about how you might 
> alert the reader to the order in which cells are executed eg when there is 
> is code in the main body and the sidebar?
>
> --tony 
>
> On Tuesday, 12 December 2017 21:21:55 UTC, Adam Rule wrote:
>>
>> I think a scrollytelling approach could be used not only for 
>> presentations, but also when working in the notebook itself. Imagine being 
>> able to "hide" cells so you get a shortened notebook with just the high 
>> level narrative and graphs, but when you scroll past these, you can see the 
>> hidden cells (likely with code or other implementation details) off to the 
>> right. I am working on an extension <https://github.com/acrule/janus> 
>> that plays with similar ideas.
>>
>> On Sunday, December 10, 2017 at 10:13:27 AM UTC-8, Tony Hirst wrote:
>>>
>>> I was wondering how much of the RISE approach could be reused? For 
>>> example, I was imagining the following is required:
>>>
>>> - deciding on what cell types to define (cf the slideshow cell types) in 
>>> metadata;
>>> - working out a template;
>>> - mapping cell types onto framework elements and inserting them into the 
>>> template.
>>>
>>> --tony
>>>
>>> On Friday, 8 December 2017 23:57:14 UTC, Damián Avila wrote:
>>>>
>>>> Hey Tony,
>>>>
>>>> I am not aware of anyone using these scroll tools reading the notebook 
>>>> cell metadata.
>>>> I would be a really interesting project.
>>>> In fact, long time ago, I though about this and also supporting other 
>>>> HTML slideshow frameworks with nbconvert slides (and eventually with RISE).
>>>> But never get enough time to start playing with the idea.
>>>>
>>>> Cheers.
>>>>
>>>> 2017-12-03 9:01 GMT-03:00 Tony Hirst <tony@gmail.com>:
>>>>
>>>>> Thinking about how the RISE plugin can be used to markup and present 
>>>>> notebooks in a presentation mode using reveal.js, I wonder: has anyone 
>>>>> looked at how to use metadata to markup a notebook and present the 
>>>>> content 
>>>>> in a "scrollytelling" mode, eg using something like 
>>>>> https://pudding.cool/process/introducing-scrollama/ , 
>>>>> https://github.com/sjwilliams/scrollstory or 
>>>>> http://idyll-lang.org/editor/ ?
>>>>>
>>>>> --tony
>>>>>
>>>>> -- 
>>>>> 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/msgid/jupyter/2c3acf72-517b-4809-9210-3277c6439056%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/jupyter/2c3acf72-517b-4809-9210-3277c6439056%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> *Damián Avila*
>>>>
>>>

-- 
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/635f29a3-539d-47c9-9ebb-023d0a575c88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Redirect Cell Events to another Cell

2017-12-12 Thread Adam Rule
I am experimenting with a notebook extension 
 that enables a 2-panel view. The left 
panel is for the high level overview cells, and the right panel for 
implementation details (see the link for an example gif). You can think of 
it as a new way of 'hiding' cells with the hidden cells being moved to a 
separate panel to the right rather than collapsed inline. 

I am wondering if there is an intelligent way to implement such a 2-panel 
view that does not hurt the integrity of the notebook (which assumes a 
linear collection of cells in the notebook div) or requiring extra event 
passing.

My current approach is to hide cells in the notebook and create a duplicate 
of the hidden cell in a new sidebar div on the same level as the notebook. 
However, now I think I need to redirect events performed in that duplicate 
cell (e.g., cell selection, execution) to the original hidden cell to get 
the notebook to behave as I want. This seems like a lot of manual 
redirecting.

Can you think of a better way to either visually move the original "hidden" 
cell, or to link the hidden and duplicate cell?

-- 
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/7f1ed0f6-c37b-4ace-add0-dce7059775c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Scrollytelling view for notebooks?

2017-12-12 Thread Adam Rule
I think a scrollytelling approach could be used not only for presentations, 
but also when working in the notebook itself. Imagine being able to "hide" 
cells so you get a shortened notebook with just the high level narrative 
and graphs, but when you scroll past these, you can see the hidden cells 
(likely with code or other implementation details) off to the right. I am 
working on an extension  that plays with 
similar ideas.

On Sunday, December 10, 2017 at 10:13:27 AM UTC-8, Tony Hirst wrote:
>
> I was wondering how much of the RISE approach could be reused? For 
> example, I was imagining the following is required:
>
> - deciding on what cell types to define (cf the slideshow cell types) in 
> metadata;
> - working out a template;
> - mapping cell types onto framework elements and inserting them into the 
> template.
>
> --tony
>
> On Friday, 8 December 2017 23:57:14 UTC, Damián Avila wrote:
>>
>> Hey Tony,
>>
>> I am not aware of anyone using these scroll tools reading the notebook 
>> cell metadata.
>> I would be a really interesting project.
>> In fact, long time ago, I though about this and also supporting other 
>> HTML slideshow frameworks with nbconvert slides (and eventually with RISE).
>> But never get enough time to start playing with the idea.
>>
>> Cheers.
>>
>> 2017-12-03 9:01 GMT-03:00 Tony Hirst :
>>
>>> Thinking about how the RISE plugin can be used to markup and present 
>>> notebooks in a presentation mode using reveal.js, I wonder: has anyone 
>>> looked at how to use metadata to markup a notebook and present the content 
>>> in a "scrollytelling" mode, eg using something like 
>>> https://pudding.cool/process/introducing-scrollama/ , 
>>> https://github.com/sjwilliams/scrollstory or 
>>> http://idyll-lang.org/editor/ ?
>>>
>>> --tony
>>>
>>> -- 
>>> 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/msgid/jupyter/2c3acf72-517b-4809-9210-3277c6439056%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> *Damián Avila*
>>
>

-- 
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/a3674c82-09f8-4d8d-84c0-b2ae8e57f410%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Fork or Revert Kernel?

2017-11-02 Thread Adam Rule
I am modifying  Min's Scratchpad 
 extension and am 
wondering if there is a way to make it so code executed in the scratchpad 
does not impact the main notebook. As it is, if I mess with parameters in 
the scratchpad, it will change those parameters in the notebook as both 
share the same kernel. Would it be possible to either:

   1. Fork the kernel to start a new one for risk-free experimenting (this 
   seems to break the one kernel per notebook paradigm)
   2. Revert the kernel to a prior state when the scratchpad is closed?

I'll look through the kernel management source code in the meantime.

-- 
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/7bc20957-5fc2-4442-97f2-aee3200d1660%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Run code when cells finished executing

2017-10-05 Thread Adam Rule
It ended up being a bit of a hack. You can see the code here 
(https://github.com/activityhistory/nbcomet/blob/master/nbcomet/static/main.js#L333).

Essentailly if it is a run-cell action, I listen for the kernel_idle.Kernel 
event.

On Thursday, October 5, 2017 at 6:05:41 AM UTC-7, Jake Stewart wrote:
>
>
> Hi Adam, 
>
> Did you ever get a workaround for this for earlier versions of Jupyter?
>
> Thanks
>
> Jake
>
> On Thursday, April 6, 2017 at 7:34:51 PM UTC+1, Adam Rule wrote:
>>
>> Just to close the loop, finished_execute.CodeCell executes just fine in 
>> v. 5.0.0, so I can listen for that before scraping the notebook. I'm going 
>> to need to find another way to get the cell data for older versions of the 
>> notebook, though.
>>
>> On Wednesday, April 5, 2017 at 8:58:33 AM UTC-7, takowl wrote:
>>>
>>> On 5 April 2017 at 16:55, Adam Rule <acr...@gmail.com> wrote:
>>>
>>>> I'm running version 4.1.0 so I'll update to 5.0 and check if 
>>>> finished_execute.CodeCell gets thrown. If not, I'll file an issue.
>>>>
>>>
>>> Thanks Adam :-)
>>>
>>

-- 
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/1d555fa4-0ec2-4366-ba27-0131316fc9ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] How to call nbdime's diff options in python

2017-07-11 Thread Adam Rule
Perfect! 

I had found `nbdime.diffing.notebooks.set_notebook_diff_targets` and 
noticed the global setting, but missed that I could use a context manager. 

On Tuesday, July 11, 2017 at 3:06:49 AM UTC-7, vidartf wrote:
>
> The function you want is 
> `nbdime.diffing.notebooks.set_notebook_diff_targets`. It is not very 
> well exposed because its current implementation is a bit hackish: It 
> currently sets what to diff in a global (i.e. for the running 
> session). As such, it is a good candidate for a refactor, but for now 
> you should probably wrap it in a context manager to ensure it is reset 
> after calling it (snippet included below for convenience). 
>
>
> from contextlib import contextmanager 
> from nbdime.diffing.notebooks import set_notebook_diff_targets 
> @contextmanager 
> def diff_targets(sources=True, outputs=True, metadata=True): 
> set_notebook_diff_targets(sources=sources, outputs=outputs, 
> metadata=metadata) 
> try: 
> yield 
> finally: 
> set_notebook_diff_targets()  # default options will reset 
>
> def only_diff_targets(sources=False, outputs=False, metadata=False): 
> return diff_targets(sources, outputs, metadata) 
>
> # Usage: 
>
> import nbdime 
> import nbformat 
> afn = 'local file.ipynb' 
> bfn = 'remote file.ipynb' 
> a = nbformat.read(afn, as_version=4) 
> b = nbformat.read(bfn, as_version=4) 
> with only_diff_targets(outputs=True): 
> diff = nbdime.diff_notebooks(a, b) 
> nbdime.prettyprint.pretty_print_notebook_diff(afn, bfn, a, diff) 
>
>
> On Mon, Jul 10, 2017 at 7:52 PM, Adam Rule <acr...@gmail.com > 
> wrote: 
> > I noticed there are console commands for controlling which part of the 
> > notebook to diff using nbdime (source, output, metadata, attachments). 
> How 
> > do I set these options when calling nbdime.diff() from python rather 
> than 
> > the command line? I've looked through the documentation and source code 
> and 
> > it seems to be related to the `differs` parameter in the diff function, 
> but 
> > I have not (yet) figured out how to set it properly. 
> > 
> > -- 
> > 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/msgid/jupyter/b7366123-7db7-4635-81c2-f27c19df0bca%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/132cfc09-b13f-4713-aea9-53e0cb0a94c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Re: How to configure setup.py for server extension and nbextension

2017-06-23 Thread Adam Rule
I think I have resolved the issue using package_data. The following code 
needed to be included in the setup.py script. 
 See 
https://docs.python.org/3.6/distutils/setupscript.html#installing-package-data

setup(
...
package_dir={'mypkg': 'mypkg'},
package_data={'mypkg': ['static/*.js']}
)

Let me know if this is the desired configuration of the setup.py file. If 
so I can sumbit a pull request on the appropriate doc, which I believe 
is 
https://github.com/jupyter/notebook/blob/e1e760367d3dfd10aa128584dd6be8ea54da64ec/docs/source/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.ipynb

On Friday, June 23, 2017 at 12:23:50 PM UTC-7, Adam Rule wrote:
>
> Hi,
>
> I am following the instructions in the documentation for distributing a 
> server extension and nbextension in a single python module and am having 
> difficulty getting my nbextension .js files to install when I run `python 
> setup.py install`. I think I need to do something in my setup.py or 
> Manifest.in file to tell the module to include the .js files in my static/ 
> folder, but I have so far been unsuccessful in doing so. When I manually 
> copy the static/ folder into my module's folder in site-packages, the rest 
> of the installation works wonderfully, but this should be automated.
>
> How do I inform the module that it needs to include the .js files in the 
> static/ folder? Also, can the documentation be updated with a template 
> setup.py file?
>
>
> http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#Example---Server-extension-and-nbextension
>
> Much 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/a1f81db0-953d-409a-bdc5-ff937e853507%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] How to configure setup.py for server extension and nbextension

2017-06-23 Thread Adam Rule
Hi,

I am following the instructions in the documentation for distributing a 
server extension and nbextension in a single python module and am having 
difficulty getting my nbextension .js files to install when I run `python 
setup.py install`. I think I need to do something in my setup.py or 
Manifest.in file to tell the module to include the .js files in my static/ 
folder, but I have so far been unsuccessful in doing so. When I manually 
copy the static/ folder into my module's folder in site-packages, the rest 
of the installation works wonderfully, but this should be automated.

How do I inform the module that it needs to include the .js files in the 
static/ folder? Also, can the documentation be updated with a template 
setup.py file?

http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#Example---Server-extension-and-nbextension

Much 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/f1c8d820-c74b-4cd4-9985-f465f57eec84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Re: Need help with custom.js

2017-05-08 Thread Adam Rule
Hi Andrey,

Are you seeing any errors in your browser console when you have a notebook 
open? That could help us diagnose the problem.

If you are using Google Chrome, you can find the console in your Developer 
Tools, which you can access by right clicking and selecting "Inspect" or 
the View > Developer > Developer Tools (at least that's how I reach it on 
Mac).

-adam

On Friday, May 5, 2017 at 12:06:17 PM UTC-7, Андрей Ширшов wrote:
>
> Hello!
>
> In Jupyter Notebook ver. 4 I had custom.js file I attached.
> After updating to Jupyter Notebook ver. 5 anything in this file stopped to 
> work.
> I cann't understand why. I have only poor knowledge of js, so it's 
> difficult
> for me to fix it. I collected all settings from internet and it's not 
> comfortable
> to work now without these settings.
>
> Please tell me what and how can I fix to make my code work.
>
> For your comfort the content of custom.js file is below:
>
> console.log("load clipboard.js");
> requirejs.config({
> paths: { 
> 'clipboard': ['notebook/js/clipboard.min']
> },
> shim: {
> clipboard: {
> deps: [],
> export: "clipboard"
> }
> }
> });
>
> // How to use:
> // %%html
> // 
> // Copy to clipboard
> // 
> // 
> // require(['clipboard'], function(Clipboard){
> // var clipboard = new Clipboard('.btn')
> // });
> // 
>
> define([
> 'base/js/namespace',
> 'codemirror/keymap/sublime', // This is js file too!
> 'base/js/events'
> ], 
> function(IPython, sublime_keymap, events) {
> events.on("app_initialized.NotebookApp", 
> function () {
> console.log("Load settings for codemirror cells")
> var cell = require("notebook/js/cell").Cell;
> cell.options_default.cm_config.lineNumbers = true;
> cell.options_default.cm_config.keyMap = 'sublime';
> cell.options_default.cm_config.lineWrapping = true;
> cell.options_default.cm_config.autoCloseBrackets = true;
> }
> );
> }
> );
>
> // This settings must be applied before mathjax will be loaded
> // because mathjax will apply all setting immediatelly after its loading.
> // We shouldn't use define function for this because mathjax
> // is loaded from 

Re: [jupyter] How to run forked version of notebook when testing contributions?

2017-04-20 Thread Adam Rule
That worked. For documentation's sake, I had to `pip uninstall notebook` 
and then `conda uninstall notebook` before I could install notebook from my 
forked and cloned notebook repository using `pip install -e .`. 

On Thursday, April 20, 2017 at 1:18:58 AM UTC-7, Min RK wrote:
>
> You are doing the right things: `pip install -e .` once and `npm run 
> build` to update js/css should be all you need.
>
> If all of those changes aren't showing up, it leads me to think that 
> perhaps a different installation of the notebook is actually in use. This 
> can happen sometimes when mixing anaconda and pip. Try running `pip 
> uninstall notebook` (repeatedly, until it says you don't have it anymore). 
> Then try starting again with `pip install -e .`.
>
> -Min
>
>
>
> On Thu, Apr 20, 2017 at 1:49 AM, Adam Rule <acr...@gmail.com 
> > wrote:
>
>> I just tried switching back to master, making changes, and rerunning 'pip 
>> install -e .' and 'npm run build' and my changes are still not showing up. 
>> I also uninstalled any version of jupyter notebook I had using "pip 
>> uninstall notebook" in case there was a conflict with the version I had 
>> already downloaded, and still no luck. Even tried "git clean -xfd" before 
>> 'pip install -e .' and 'npm run build' and my changes are still not showing 
>> up.
>>
>> I have also tried changing some of the template HTML (i.e. notebook.html) 
>> for immediately visible changes to how menus are named, and no luck.
>>
>>
>> On Wednesday, April 19, 2017 at 4:38:55 PM UTC-7, Adam Rule wrote:
>>>
>>> Could it be something with my branches? For example, I have a 
>>> development branch I'm working on, but could "pip install -e ." be pulling 
>>> from master?
>>>
>>> On Wednesday, April 19, 2017 at 3:00:07 PM UTC-7, Adam Rule wrote:
>>>>
>>>> I am attempting to change actions.js and notebook.js so that the three 
>>>> paste items in the Edit menubar call a paste action rather than the paste 
>>>> function directly (issue #2415 
>>>> <https://github.com/jupyter/notebook/issues/2415>). 
>>>>
>>>> I have run "pip install -e ." in the folder containing the forked and 
>>>> cloned code and I do have node and npm installed have been running "npm 
>>>> run build" every time I may changes to the .js or .css codebase.
>>>>
>>>> When I run "which jupyter notebook" in my terminal I get "
>>>> /anaconda/bin/jupyter" when I would have expected it to point to where 
>>>> I have the cloned code (e.g. ~/Code/notebook). Do I have the wrong mental 
>>>> model of where the code is being executed from?
>>>>
>>>> On Wednesday, April 19, 2017 at 1:38:12 PM UTC-7, takowl wrote:
>>>>>
>>>>> Hi Adam,
>>>>>
>>>>> Do you have the necessary Javascript tools set up to rebuild 
>>>>> Javascript and CSS if you're changing those pieces?
>>>>> http://jupyter-notebook.readthedocs.io/en/latest/contributing.html
>>>>>
>>>>> Changes to frontend stuff are also sometimes hidden by the browser 
>>>>> cache. Usually pressing Ctrl-F5 a few times is enough to clear the cache, 
>>>>> but if not, other tricks include trying with a different browser from 
>>>>> normal, opening it in private/incognito mode, or starting the notebook 
>>>>> server on a different port from the default  (e.g. --port 8931).
>>>>>
>>>>> Thomas
>>>>>
>>>>> On 19 April 2017 at 19:56, Adam Rule <acr...@gmail.com> wrote:
>>>>>
>>>>>> I'm attempting to Contribute 
>>>>>> <https://github.com/jupyter/notebook/blob/master/CONTRIBUTING.rst> 
>>>>>> to the Notebook and have followed the instructions 
>>>>>> <https://jupyter.readthedocs.io/en/latest/developer-docs/contrib_guide_code.html>
>>>>>>  
>>>>>> for forking, branching, and making changes to the codebase.
>>>>>>
>>>>>> However, when I run `jupyter notebook` in my terminal, it seems to 
>>>>>> still launch my previously installed version of the notebook software, 
>>>>>> not 
>>>>>> the modified version I've downloaded and am editing. How do I run this 
>>>>>> modified version so I can visually check that my changes are producing 
>>>>>> th

Re: [jupyter] How to run forked version of notebook when testing contributions?

2017-04-19 Thread Adam Rule
I just tried switching back to master, making changes, and rerunning 'pip 
install -e .' and 'npm run build' and my changes are still not showing up. 
I also uninstalled any version of jupyter notebook I had using "pip 
uninstall notebook" in case there was a conflict with the version I had 
already downloaded, and still no luck. Even tried "git clean -xfd" before 
'pip install -e .' and 'npm run build' and my changes are still not showing 
up.

I have also tried changing some of the template HTML (i.e. notebook.html) 
for immediately visible changes to how menus are named, and no luck.

On Wednesday, April 19, 2017 at 4:38:55 PM UTC-7, Adam Rule wrote:
>
> Could it be something with my branches? For example, I have a development 
> branch I'm working on, but could "pip install -e ." be pulling from master?
>
> On Wednesday, April 19, 2017 at 3:00:07 PM UTC-7, Adam Rule wrote:
>>
>> I am attempting to change actions.js and notebook.js so that the three 
>> paste items in the Edit menubar call a paste action rather than the paste 
>> function directly (issue #2415 
>> <https://github.com/jupyter/notebook/issues/2415>). 
>>
>> I have run "pip install -e ." in the folder containing the forked and 
>> cloned code and I do have node and npm installed have been running "npm 
>> run build" every time I may changes to the .js or .css codebase.
>>
>> When I run "which jupyter notebook" in my terminal I get "
>> /anaconda/bin/jupyter" when I would have expected it to point to where I 
>> have the cloned code (e.g. ~/Code/notebook). Do I have the wrong mental 
>> model of where the code is being executed from?
>>
>> On Wednesday, April 19, 2017 at 1:38:12 PM UTC-7, takowl wrote:
>>>
>>> Hi Adam,
>>>
>>> Do you have the necessary Javascript tools set up to rebuild Javascript 
>>> and CSS if you're changing those pieces?
>>> http://jupyter-notebook.readthedocs.io/en/latest/contributing.html
>>>
>>> Changes to frontend stuff are also sometimes hidden by the browser 
>>> cache. Usually pressing Ctrl-F5 a few times is enough to clear the cache, 
>>> but if not, other tricks include trying with a different browser from 
>>> normal, opening it in private/incognito mode, or starting the notebook 
>>> server on a different port from the default  (e.g. --port 8931).
>>>
>>> Thomas
>>>
>>> On 19 April 2017 at 19:56, Adam Rule <acr...@gmail.com> wrote:
>>>
>>>> I'm attempting to Contribute 
>>>> <https://github.com/jupyter/notebook/blob/master/CONTRIBUTING.rst> to 
>>>> the Notebook and have followed the instructions 
>>>> <https://jupyter.readthedocs.io/en/latest/developer-docs/contrib_guide_code.html>
>>>>  
>>>> for forking, branching, and making changes to the codebase.
>>>>
>>>> However, when I run `jupyter notebook` in my terminal, it seems to 
>>>> still launch my previously installed version of the notebook software, not 
>>>> the modified version I've downloaded and am editing. How do I run this 
>>>> modified version so I can visually check that my changes are producing the 
>>>> behavior I expect?
>>>>
>>>> -- 
>>>> 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/msgid/jupyter/ec9e5f23-d9e2-4238-a053-333d1c52469b%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jupyter/ec9e5f23-d9e2-4238-a053-333d1c52469b%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> 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/8ac39ce6-0c71-4812-8808-73023e4d4bc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] How to run forked version of notebook when testing contributions?

2017-04-19 Thread Adam Rule
Could it be something with my branches? For example, I have a development 
branch I'm working on, but could "pip install -e ." be pulling from master?

On Wednesday, April 19, 2017 at 3:00:07 PM UTC-7, Adam Rule wrote:
>
> I am attempting to change actions.js and notebook.js so that the three 
> paste items in the Edit menubar call a paste action rather than the paste 
> function directly (issue #2415 
> <https://github.com/jupyter/notebook/issues/2415>). 
>
> I have run "pip install -e ." in the folder containing the forked and 
> cloned code and I do have node and npm installed have been running "npm 
> run build" every time I may changes to the .js or .css codebase.
>
> When I run "which jupyter notebook" in my terminal I get "
> /anaconda/bin/jupyter" when I would have expected it to point to where I 
> have the cloned code (e.g. ~/Code/notebook). Do I have the wrong mental 
> model of where the code is being executed from?
>
> On Wednesday, April 19, 2017 at 1:38:12 PM UTC-7, takowl wrote:
>>
>> Hi Adam,
>>
>> Do you have the necessary Javascript tools set up to rebuild Javascript 
>> and CSS if you're changing those pieces?
>> http://jupyter-notebook.readthedocs.io/en/latest/contributing.html
>>
>> Changes to frontend stuff are also sometimes hidden by the browser cache. 
>> Usually pressing Ctrl-F5 a few times is enough to clear the cache, but if 
>> not, other tricks include trying with a different browser from normal, 
>> opening it in private/incognito mode, or starting the notebook server on a 
>> different port from the default  (e.g. --port 8931).
>>
>> Thomas
>>
>> On 19 April 2017 at 19:56, Adam Rule <acr...@gmail.com> wrote:
>>
>>> I'm attempting to Contribute 
>>> <https://github.com/jupyter/notebook/blob/master/CONTRIBUTING.rst> to 
>>> the Notebook and have followed the instructions 
>>> <https://jupyter.readthedocs.io/en/latest/developer-docs/contrib_guide_code.html>
>>>  
>>> for forking, branching, and making changes to the codebase.
>>>
>>> However, when I run `jupyter notebook` in my terminal, it seems to still 
>>> launch my previously installed version of the notebook software, not the 
>>> modified version I've downloaded and am editing. How do I run this modified 
>>> version so I can visually check that my changes are producing the behavior 
>>> I expect?
>>>
>>> -- 
>>> 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/msgid/jupyter/ec9e5f23-d9e2-4238-a053-333d1c52469b%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jupyter/ec9e5f23-d9e2-4238-a053-333d1c52469b%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/ac524058-33ba-40d4-86dd-6968b405d0a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] How to run forked version of notebook when testing contributions?

2017-04-19 Thread Adam Rule
I am attempting to change actions.js and notebook.js so that the three 
paste items in the Edit menubar call a paste action rather than the paste 
function directly (issue #2415 
<https://github.com/jupyter/notebook/issues/2415>). 

I have run "pip install -e ." in the folder containing the forked and 
cloned code and I do have node and npm installed have been running "npm run 
build" every time I may changes to the .js or .css codebase.

When I run "which jupyter notebook" in my terminal I get "
/anaconda/bin/jupyter" when I would have expected it to point to where I 
have the cloned code (e.g. ~/Code/notebook). Do I have the wrong mental 
model of where the code is being executed from?

On Wednesday, April 19, 2017 at 1:38:12 PM UTC-7, takowl wrote:
>
> Hi Adam,
>
> Do you have the necessary Javascript tools set up to rebuild Javascript 
> and CSS if you're changing those pieces?
> http://jupyter-notebook.readthedocs.io/en/latest/contributing.html
>
> Changes to frontend stuff are also sometimes hidden by the browser cache. 
> Usually pressing Ctrl-F5 a few times is enough to clear the cache, but if 
> not, other tricks include trying with a different browser from normal, 
> opening it in private/incognito mode, or starting the notebook server on a 
> different port from the default  (e.g. --port 8931).
>
> Thomas
>
> On 19 April 2017 at 19:56, Adam Rule <acr...@gmail.com > 
> wrote:
>
>> I'm attempting to Contribute 
>> <https://github.com/jupyter/notebook/blob/master/CONTRIBUTING.rst> to 
>> the Notebook and have followed the instructions 
>> <https://jupyter.readthedocs.io/en/latest/developer-docs/contrib_guide_code.html>
>>  
>> for forking, branching, and making changes to the codebase.
>>
>> However, when I run `jupyter notebook` in my terminal, it seems to still 
>> launch my previously installed version of the notebook software, not the 
>> modified version I've downloaded and am editing. How do I run this modified 
>> version so I can visually check that my changes are producing the behavior 
>> I expect?
>>
>> -- 
>> 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/msgid/jupyter/ec9e5f23-d9e2-4238-a053-333d1c52469b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jupyter/ec9e5f23-d9e2-4238-a053-333d1c52469b%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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/5490b826-3f0e-44e5-9560-45e4deda8197%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] How to run forked version of notebook when testing contributions?

2017-04-19 Thread Adam Rule
I'm attempting to Contribute 
 to the 
Notebook and have followed the instructions 

 
for forking, branching, and making changes to the codebase.

However, when I run `jupyter notebook` in my terminal, it seems to still 
launch my previously installed version of the notebook software, not the 
modified version I've downloaded and am editing. How do I run this modified 
version so I can visually check that my changes are producing the behavior 
I expect?

-- 
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/ec9e5f23-d9e2-4238-a053-333d1c52469b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Run code when cells finished executing

2017-04-06 Thread Adam Rule
Just to close the loop, finished_execute.CodeCell executes just fine in v. 
5.0.0, so I can listen for that before scraping the notebook. I'm going to 
need to find another way to get the cell data for older versions of the 
notebook, though.

On Wednesday, April 5, 2017 at 8:58:33 AM UTC-7, takowl wrote:
>
> On 5 April 2017 at 16:55, Adam Rule <acr...@gmail.com > 
> wrote:
>
>> I'm running version 4.1.0 so I'll update to 5.0 and check if 
>> finished_execute.CodeCell gets thrown. If not, I'll file an issue.
>>
>
> Thanks Adam :-)
>

-- 
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/345f9026-d0eb-4323-8f9b-7389e96a7bba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] Run code when cells finished executing

2017-04-05 Thread Adam Rule
I'm running version 4.1.0 so I'll update to 5.0 and check if 
finished_execute.CodeCell gets thrown. If not, I'll file an issue.

On Wednesday, April 5, 2017 at 7:11:36 AM UTC-7, takowl wrote:
>
> On 4 April 2017 at 23:34, Adam Rule <acr...@gmail.com > 
> wrote:
>
>> My problem is that some actions seem to call code that runs 
>> asynchronously and my post-application block runs before the action has 
>> been applied. 
>>
>
> Yeah, that's not uncommon with Javascript - lots of things are async, so a 
> function may well return before the effect it's meant to produce has 
> happened. Feel free to propose more events if the existing ones don't meet 
> your needs - I don't think there's much cost to adding more events.
>  
>
>> Looking through the code base 
>> <https://github.com/jupyter/notebook/blob/5db6db740740bc62c9dd40a92f37726f7b59ac9e/notebook/static/notebook/js/codecell.js#L340>
>>  I 
>> thought I could listen for finished_execute.CodeCell but that event 
>> never seems to fire.
>>
>
> That might be a bug - can you file an issue about it? And if you have 
> time, try to track down why it might be going missing? And check that 
> you've got the latest version of notebook - 5.0 was just released.
>
> Thomas
>
>

-- 
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/484c1eaa-6c1b-44a8-bb5c-f98c76faf620%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] Run code when cells finished executing

2017-04-04 Thread Adam Rule
Hello,

I am writing both a notebook extension and a server extension to track 
changes to notebooks over time. *How can I run code after an action has 
been applied?*

In the notebook extension, I'm attempting to execute blocks of code both 
before and after Jupyter performs certain actions (e.g., 
'run-cell-and-select-next', 'split-cell-at-cursor') so that I can track how 
these actions affect the notebook. My problem is that some actions seem to 
call code that runs asynchronously and my post-application block runs 
before the action has been applied. 

For example, when I call var mod = this.env.notebook.toJSON(); to get the 
sate of the notebook after the run-cell-and-select-next action has been 
called, the kernal has often not finished executing the code or rendering 
the output.

Looking through the code base 

 I 
thought I could listen for finished_execute.CodeCell but that event never 
seems to fire.

I include my code below. 


function patch_actionHandler_call(){
/* Inject code into the actionhandler to track desired actions */


console.log('[Comet] patching ActionHandler.prototype.call');
var old_call = ActionHandler.__proto__.call;


ActionHandler.__proto__.call = function (){


var actionName = arguments[0].split(":")[1]; // remove 
'jupter-notebook:' prefix


if(actions_to_intercept.indexOf(actionName)>-1){
// get time, action name, and selected cell(s) before 
action applied
var t = Date.now();
var selectedIndex = this.env.notebook.get_selected_index();
var selectedIndices = this.env.notebook.
get_selected_cells_indices();


// let the notebook apply the action
old_call.apply(this, arguments);


// now get the modified notebook and its url
var mod = this.env.notebook.toJSON();
var notebookUrl =  this.env.notebook.notebook_path;
var baseUrl = this.env.notebook.base_url;
var url = utils.url_path_join(baseUrl, 'api/comet', 
notebookUrl);


// and send the data to the server extension for processing
sendData(t, actionName, selectedIndex, selectedIndices, mod, 
url);
}
else{
old_call.apply(this, arguments);
}
}
};

-- 
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/9cb896b6-ebdb-4689-849d-aa49e9326133%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jupyter] How do I install a Jupyter Notebook Server extension?

2017-02-24 Thread Adam Rule
Much thanks!

On Friday, February 24, 2017 at 10:27:29 AM UTC-8, takowl wrote:
>
> On 24 February 2017 at 18:18, Thomas Kluyver  > wrote:
>
>> Thanks for the heads up, I'll update the docs to use nbserver_extensions.
>>
>
> https://github.com/jupyter/notebook/pull/2224
>

-- 
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/2444f036-9c60-4626-988d-37fdb0050fce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jupyter] How do I install a Jupyter Notebook Server extension?

2017-02-24 Thread Adam Rule
I am attempting to follow the directions in the Documentation 

 for 
writing and installing a custom server extension, but have encountered 
several issues. *How do I install a server extension?* And can the 
documentation be updated?

I copied the example extension code at the end of the documentation to a 
file called `example_server_handler.py` and put this file into a folder 
called `server_extension`

   1. When I ran jupyter notebook 
   
--NotebookApp.server_extensions="['server_extension.example_server_handler.py']"
  1.  server_extensions is deprecated, use nbserver_extensions
   2. When I ran jupyter notebook 
   
--NotebookApp.nbserver_extensions="['server_extension.example_server_handler.py']"
  1. The 'nbserver_extensions' trait of a NotebookApp instance must be 
  a dict, but a value of class 'list' (i.e. 
  ['server_extension.example_server_handler.py']) was specified.
   3. When I ran jupyter notebook 
   
--NotebookApp.nbserver_extensions="{'server_extension.example_server_handler.py':
 
   True}"
  1. ImportError: No module named 'server_extension'
  
I assume the issue is that I have not actually installed the extension, or 
don't have it on my path.

-- 
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/612089a9-2a1a-4b80-b154-7b6161e45d3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.